OFFSET
1,2
COMMENTS
Does this sequence contain every positive integer? We could get an equally interesting sequence by choosing a(1) to be any other positive integer.
A sequence with the same condition but without the requirement for a(n) to be distinct would end up repeating (1,3) or (2,4), depending on the initial term. - Ivan Neretin, May 26 2015
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
EXAMPLE
10 is followed by 36 because 10*36+1 = 19^2 and 8 and 12 were already used.
MAPLE
N:= 10^4: Used:= Vector(N, datatype=integer[4]):
a[1]:= 1: blocked:= false: Used[1]:= 1:
for n from 2 to 100 while not(blocked) do
ndone:= false;
if n = 2 then T:= [0]
else T:= select(t -> t^2 mod a[n-1] = 1, [$0..a[n-1]-1])
fi;
for s from 0 while not (ndone) do
for t in T while not (ndone) do
x:= s * a[n-1] + t;
if x <= 1 then next fi;
y:= (x^2-1)/a[n-1];
if y > N then blocked:= true; ndone:= true
elif Used[y] = 0 then
a[n]:= y;
Used[y]:= 1;
ndone:= true;
print(n, y);
fi
od
od
od:
seq(a[n], n=1..100); # Robert Israel, May 26 2015
MATHEMATICA
a = {1}; Do[a = Join[a, Select[Complement[Range[(Max[a] + 1)*n], a], IntegerQ[Sqrt[#*a[[-1]] + 1]] &, 1]], {n, 2, 71}]; a (* Ivan Neretin, May 26 2015 *)
PROG
(MATLAB) A = zeros(1, 100); A(1) = 1; used = zeros(1, 1000); used(1) = 1; for i = 2:100; found = 0; k = 0; while found == 0; k = k + 1; if used(k) == 0; s = sqrt(k*A(i - 1) + 1); if s == floor(s); A(i) = k; used(k) = 1; found = 1; end; end; end; end; A
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
David Wasserman, Mar 04 2004
STATUS
approved