This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A046901 a(n) = a(n-1) - n if a(n-1) > n, else a(n) = a(n-1) + n. 14

%I

%S 1,3,6,2,7,1,8,16,7,17,6,18,5,19,4,20,3,21,2,22,1,23,46,22,47,21,48,

%T 20,49,19,50,18,51,17,52,16,53,15,54,14,55,13,56,12,57,11,58,10,59,9,

%U 60,8,61,7,62,6,63,5,64,4,65,3,66,2,67,1,68,136,67,137

%N a(n) = a(n-1) - n if a(n-1) > n, else a(n) = a(n-1) + n.

%C Variation (1) on Recamán's sequence A005132.

%C a(A134931(n-1)) = 1. - _Reinhard Zumkeller_, Jan 31 2013

%H N. J. A. Sloane, <a href="/A046901/b046901.txt">First 10000 terms</a>

%H Nick Hobson, <a href="/A046901/a046901.py.txt">Python program for this sequence</a>

%H Kival Ngaokrajang, <a href="/A046901/a046901.pdf">scatter plot in log-log scale looks</a>, for both this sequence and A211346.

%H <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>

%F This is a concatenation S_0, S_1, S_2, ... where S_i = [b_0, b_1, ..., b_{k-1}], k=5*3^i, with b_0 = 1, b_{2j} = k+j, b_{2j+1} = (k+1)/2-j. E.g., S_0 = [1, 3, 6, 2, 7].

%F For any m>=1, for k such that 5*3^k+3>12m, a((5*3^k+3-12*m)/6)= m. For example, for k>=1, a((5*3^k-9)/6) = 1. - _Benoit Cloitre_, Oct 31 2002

%p A046901 := proc(n) option remember; if n = 1 then 1 else if A046901(n-1)>n then A046901(n-1)-n else A046901(n-1)+n; fi; fi; end;

%t a[1]=1;a[n_]:=a[n]=If[a[n-1]>n,a[n-1]-n,a[n-1]+n]; Table[a[i],{i,70}] (* _Harvey P. Dale_, Apr 01 2011 *)

%o (PARI) a(n)=if(n<2,1,a(n-1)-if(sign(n-a(n-1))+1,-1,1)*n);

%o a046901 n = a046901_list !! (n-1)

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

%o -- _Reinhard Zumkeller_, Dec 07 2015, Jan 31 2013

%Y Cf. A008344, A005132.

%Y Cf. A076039, A003462, A076041, A076042, A057198.

%Y Cf. A085059.

%Y Cf. A238324.

%K easy,nonn,nice,look

%O 1,2

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified November 17 07:44 EST 2018. Contains 317275 sequences. (Running on oeis4.)