OFFSET
1,2
COMMENTS
Is A105822 a permutation of the positive integers?
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..1000
MAPLE
N:= 1000: # to go up to the first entry missing in A105822(1 .. N)
A:= 'A':
a[1]:= 1: a[2]:= 2:
A[1]:= 1: A[2]:= 2:
for n from 3 to N do
ds:= map(t -> rhs(op(t)), [msolve(x^2=a[n-1]^2, 4*a[n-2])]);
xmin:= infinity;
for d in ds do
found:= false;
for y from floor((a[n-1]-d)/(4*a[n-2]))+1 do
xy:= 4*a[n-2]*y + d;
cand:= (xy^2 - a[n-1]^2)/(4*a[n-2]);
if cand >= xmin then found:= false; break fi;
if not assigned(A[cand]) then found:= true; break fi;
od:
if found then xmin:= cand; fi;
od:
a[n]:= xmin;
A[xmin]:= n;
od:
M:= min(select(t -> not assigned(A[t]), [$1..N+1])):
seq(A[i], i=1..M-1); # Robert Israel, May 11 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Apr 22 2005
EXTENSIONS
Definition corrected by N. J. A. Sloane, Aug 29 2008
STATUS
approved