login
Recamán-like sequence: a(0) = 0: for n > 0, a(n) = a(n-1) - 2*n if positive and not already in the sequence, otherwise a(n) = a(n-1) + n.
1

%I #16 Oct 28 2019 02:23:42

%S 0,1,3,6,10,15,21,7,15,24,4,15,27,40,12,27,43,9,27,46,66,87,109,63,87,

%T 37,63,90,34,63,93,31,63,96,28,63,99,25,63,102,22,63,105,19,63,108,16,

%U 63,111,13,63,114,166,60,114,169,57,114,172,54,114,175,51

%N Recamán-like sequence: a(0) = 0: for n > 0, a(n) = a(n-1) - 2*n if positive and not already in the sequence, otherwise a(n) = a(n-1) + n.

%C Conjecture: This is a surjection onto A032766.

%H Peter Kagey, <a href="/A306698/b306698.txt">Table of n, a(n) for n = 0..10000</a>

%H Laura Kuttnig, <a href="https://youtu.be/SK960C-ucZc">One step forward - two steps back --- Recamán Variation</a>, Youtube video, Feb 28, 2019.

%H Reddit user NonEuclideanDreamer, <a href="https://www.reddit.com/r/math/comments/axkqew/one_step_forward_two_steps_back_a_variation_of/">One step forward - two steps back --- A Variation of the Recamán Sequence</a>

%t Nest[Append[#1, If[And[#3 >= 0, FreeQ[#1, #3]], #3, Last[#1] + #2]] & @@ {#1, #2, Last[#1] - 2 #2} & @@ {#, Length@ #} &, {0}, 62] (* _Michael De Vlieger_, Mar 11 2019 *)

%Y Cf. A005132, A032766.

%K nonn

%O 0,3

%A _Peter Kagey_, Mar 05 2019