%I #16 Feb 19 2016 07:47:44
%S 1,2,3,5,8,13,21,4,25,29,54,7,61,68,129,11,140,151,12,163,175,338,18,
%T 356,374,19,393,412,20,432,452,884,1336,36,6,42,48,90,9,99,108,10,118,
%U 128,246,15,261,16,277,293,17,310,327,637,964,31,995,1026,32
%N a(1) = 1 and a(2) = 2; thereafter a(n+1) = floor[sqrt(a(n))] if not already in the sequence; otherwise a(n+1) = a(n) + a(n-1).
%C Hans Havermann found that the sequence is not a permutation of the integers since a(708)=a(1276)=1666.
%H Melvin Peralta, <a href="/A268962/b268962.txt">Table of n, a(n) for n = 1..20000</a>
%t seq = {1, 2}; max; n = 3; While[n < max, If[MemberQ[seq, Floor[Sqrt[Last[seq]]]] == False, AppendTo[seq, Floor[Sqrt[Last[seq]]]], AppendTo[seq, Last[seq] + Part[seq, n - 2]]]; n++]
%o (PARI) A268962_vec=A268962_used=[1,2]; A268962(n)={ #A268962_vec>=n || A268962_vec=concat(A268962_vec,vector(n-#A268962_vec)); A268962_vec[n] || for(n=#A268962_used+A268962_used[1],n, A268962_vec[n]&&next; (A268962_vec[n-1]<(A268962_used[1]+1)^2 || setsearch(A268962_used,A268962_vec[n]=sqrtint(A268962_vec[n-1]))) && A268962_vec[n]=A268962_vec[n-1]+A268962_vec[n-2]; A268962_used=setunion(A268962_used,A268962_vec[n..n]); while(#A268962_used>1 && A268962_used[2]==A268962_used[1]+1,A268962_used=A268962_used[^1])); A268962_vec[n]} \\ _M. F. Hasler_, Feb 16 2016
%Y Cf. A014682, A114183, A000045
%K nonn
%O 1,2
%A _Melvin Peralta_, Feb 16 2016
|