OFFSET
0,3
COMMENTS
Conjectured to be a permutation of the nonnegative integers.
LINKS
Zak Seidov and P. Pein, Table of n, a(n) for n = 0..10000
Ely Golden, Python program
MAPLE
N:= 1000: # to go up to the first term > N
B:= Vector(N):
a[0]:= 0:
found:= true:
for n from 1 while found do
found:= false:
for k from floor(sqrt(a[n-1]))+1 do
b:= k^2 - a[n-1];
if b > N then a[n]:= b; break fi;
if B[b] = 0 then
found:= true;
a[n]:= b;
B[b]:= 1;
break
fi
od
od:
seq(a[i], i=0..n-1); # Robert Israel, Jun 02 2015
MATHEMATICA
a[ 0 ]=b[ 0 ]=0; lst={0}; For[ n=1, n<250, n++, For[ s=Ceiling[ Sqrt[ a[ n-1 ] ] ], MemberQ[ lst, s^2-a[ n-1 ] ], s++, Null ]; b[ a[ n ]=s^2-a[ n-1 ] ]=n; AppendTo[ lst, a[ n ] ] ]; Table[ a[ n ], {n, 0, 100} ]
(* Second program: *)
lst = {}; f[s_List] := Block[{k = 1, l = s[[ -1]]}, While[ MemberQ[s, k] || !IntegerQ@ Sqrt[k + l], k++ ]; AppendTo[lst, k]]; Nest[f, lst, 100] (* Robert G. Wilson v, May 09 2010 *)
PROG
(PARI) my(v=List(0), vs = vecsort(Vec(v)), n=1); while(n<50, if(issquare(v[#v]+n) && !vecsearch(vs, n), listput(v, n); vs = vecsort(Vec(v)); n=0); n++); Vec(v) \\ Derek Orr, Jun 01 2015; edited by Michel Marcus, Jan 04 2022
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Dean Hickerson, Oct 01 1998
STATUS
approved