login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(1) = 1 and a(n+1) = if a(n) > 2*n+1 then a(n)-2*n-1 else a(n)+2*n+1.
3

%I #34 Oct 07 2016 14:39:13

%S 1,4,9,2,11,22,9,24,7,26,5,28,3,30,1,32,65,30,67,28,69,26,71,24,73,22,

%T 75,20,77,18,79,16,81,14,83,12,85,10,87,8,89,6,91,4,93,2,95,190,93,

%U 192,91,194,89,196,87,198,85,200,83,202,81,204,79,206,77

%N a(1) = 1 and a(n+1) = if a(n) > 2*n+1 then a(n)-2*n-1 else a(n)+2*n+1.

%C Abs(a(n+1) - a(n)) = 2*n+1;

%C a(A265327(n)) = n and a(m) != n for m < A265327(n).

%H Reinhard Zumkeller, <a href="/A238324/b238324.txt">Table of n, a(n) for n = 1..10000</a>

%t nxt[{n_,a_}]:={n+1,If[a>2n+1,a-2n-1,a+2n+1]}; NestList[nxt,{1,1},70][[All,2]] (* _Harvey P. Dale_, Oct 07 2016 *)

%o (Haskell)

%o a238324 n = a238324_list !! (n-1)

%o a238324_list = scanl1 (\u v -> if u > v then u - v else u + v) [1, 3 ..]

%Y Cf. A005408, A046901, A265327.

%K nonn

%O 1,2

%A _Reinhard Zumkeller_, Dec 07 2015