# [seqfan] Subtracting or adding n to a(n-1)

Leroy Quet q1qq2qqq3qqqq at yahoo.com
Wed Apr 29 18:31:40 CEST 2009

```A couple of things:

Consider the sequence:
a(0)=0.
a(n) = |a(n-1)-n|, if |a(n-1)-n| does not occur among terms a(0) through a(n-1).
a(n) = a(n-1)+n, otherwise.

This starts the same as Recaman's sequence, A005132.
a(0)=0. a(n) = a(n-1)-n if a(n-1)-n is positive and does not occur earlier in the sequence.
a(n) = a(n-1)+n, otherwise.

Are they the same sequence?
So, the question, I suppose, is, is there any value a(n-1) of my sequence such that
a(n-1)-n is both negative and its absolute value is unique among terms a(0) through a(n-1) of the sequence?
If so, then my sequence isn't Recaman's. Since a(n) would differ from Recaman's.

Next question: Consider my sequence again, but let a(0) = the integer m.

We can construct 3 sequences here, where {a_m(k)} is my sequence with starting value m:

b(m) = the smallest positive integer j such that a_m(j) = a_m(k) for some k where 0<=k<j.

I think this sequence begins (offset 0):
24,16,21,3,12,..
(Not in EIS.)

c(m) = the value of k in the definition of b(m).
I think this sequence starts:
20,12,17,0,8,...

f(m) = a_m(b(m)) = a_m(c(m)):

f(m): 42,33,33,3,20,...

Did I make any mistakes? I have yet to submit these sequences. I am waiting to see if the first sequence above is the same as Recaman's.

Thanks,
Leroy Quet

```