%I #8 Nov 21 2013 12:47:54
%S 1,2,4,4,8,10,13,16,23,30,38,40,41,42,54,60,69,72,87,100,116,122,129,
%T 144,163,182,202,208,213,240,263,288,312,318,321,324,352,362,373,400,
%U 431,462,494,504,513,552,587,624,660,670,677,728,767,810,850,860,865
%N a(1)=1 a(n) = a(n-1) + ((-1)^a(n-1)*a(n-1)) mod n.
%F a(n) is asymptotic to 4n^2/15; a(n)=4n^2/15 if n is of the form 30*(2k+1) hence a(60k+30) = 1800*(2k+1)^2
%e a(8) = a(7) + ( (-1)^a(7)*a(7)) mod 8 = 13 + (- 13) mod 8 = 13 + 3 = 16
%t RecurrenceTable[{a[1]==1,a[n]==a[n-1]+Mod[(-1)^a[n-1] a[n-1],n]},a,{n,60}] (* _Harvey P. Dale_, Nov 09 2011 *)
%o (PARI) a(n)=a(n-1)+((-1)^a(n-1)*a(n-1))%n
%K nonn
%O 1,2
%A _Benoit Cloitre_, Nov 07 2002