# [seqfan] Re: Help with defining a sequence

Marc LeBrun mlb at well.com
Fri Oct 23 18:59:25 CEST 2020

```> I would really appreciate your help defining the sequence below.

Ali, sounds interesting but I found your verbal description hard to follow.  You apparently have implemented this as an algorithm;   consulting the code might have helped resolve questions, but you didn't include it.

May I suggest that you maybe start by doing something in-between: write out the algorithm, but express the steps in "pseudo code"?

For example I got confused right away by "we take the difference from the next pair".  Some ambiguities were in what you meant by "take" and what "difference" you were referring to (ie different between what and what?)

A start might go something like this:

0. For successive n: we modify both the n-th pair, say P[n]=(p,q), and the next pair, P[n+1]=(r,s).
1. We want P[n] to be (p,2p) so let's call the difference d = 2p - q
2. If d>0 we subtract d from first element of P[n+1], changing it to (r-d,s)... [*note]
3.  ...and add it to the second element of P[n], changing it to (p,q+d) = (p,2p)

[* note] Actually, I was also unclear if you must always subtract d from the first element of P[n+1] and add it to the second element of P[n], or if you could also subtract from s and/or add to p -- but that's at least what you did in the very first part of your description...

Is that the right algorithm?  Make sure it's described very clearly, and it should greatly help describing the sequences it produces.

```