%I #29 Dec 13 2017 11:51:08
%S 0,1,2,0,1,1,3,1,5,7,0,1,2,13,1,1,3,17,2,2,5,21,4,23,3,2,5,0,1,1,3,1,
%T 5,31,0,1,2,37,1,1,3,41,2,2,5,45,4,47,3,2,5,0,1,1,3,1,5,55,0,1,2,61,1,
%U 1,3,65,2,2,5,69,4,2,7,72,0,1,2,1,4,1,6,78,80,6,2,79,84,11,3,82,70,0,1,1,3
%N Sequence defined by the recursion a(n)=(1+a(n-1-(n mod a(n-1)))-(-1)^n*a(n-1)) mod n, with a(1)=0.
%C Erratic behavior with 0<=a(n)<n (see linked picture).
%C Similar sequence with a(1)=1.
%D G. Balzarotti and P. P. Lava, 103 curiosità matematiche, Hoepli, 2010, p. 275.
%H Paolo P. Lava, <a href="/A176076/b176076.txt">Table of n, a(n) for n = 1..10000</a>
%H Paolo P. Lava, <a href="/A176076/a176076.pdf">Graphic of the first 10000 terms of the sequence</a>
%H John A. Pelesko, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL7/Pelesko/pel11.html">Generalizing the Conway-Hofstadter $10,000 Sequence</a>, Journal of Integer Sequences, Vol. 7 (2004), Article 04.3.5.
%H Klaus Pinn, <a href="http://arxiv.org/abs/cond-mat/9808031">A Chaotic Cousin Of Conway's Recursive Sequence</a>, arXiv:cond-mat/9808031, 1998.
%F a(n) = (1+a(n-1-(n mod a(n-1)))-(-1)^n*a(n-1)) mod n, with a(1)=0.
%e a(1)=0.
%e a(2)=(1+a(1-(2 mod 1))) mod 2=(1+0) mod 2=1.
%e a(3)=(1+a(2-(3 mod (1+1)))+1) mod 3=(1+a(1)+1) mod 3=2 mod 3=2.
%e a(4)=(1+a(3-(4 mod (1+2)))-2) mod 4=(1+a(2)-2) mod 4=0.
%p P:=proc(i) local a,n; a:=array(1..50000); a[1]:=0; print(a[1]); for n from 2 by 1 to i do a[n]:=(1+a[n-1-(n mod (1+a[n-1]))]-(-1)^n*a[n-1]) mod n; print(a[n]); od; end: P(10000);
%t a[1]=0; a[n_] := a[n] = Mod[-(-1)^n*a[n-1] + a[n-Mod[n, a[n-1]+1]-1]+1, n];
%t Array[a, 100] (* _Jean-François Alcover_, Dec 13 2017 *)
%Y Cf. A004001, A176075.
%K nonn
%O 1,3
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Apr 21 2010
%E Offset corrected by _Arkadiusz Wesolowski_, Jun 07 2011
|