OFFSET
1,2
COMMENTS
a(n) is the smallest number larger than a(n-1) such that a(n-1) is a quadratic residue mod a(n). - R. J. Mathar, Jul 27 2015
LINKS
T. D. Noe, Table of n, a(n) for n=1..1000
EXAMPLE
For n=3 we have a(2)=2. 2 is not quadratic residue mod 3 because the quadratic residues mod 3 are {0,1}, see A011655. 2 is not a quadratic residue mod 4 because the quadratic residues mod 4 are {0,1}, see A000035. 2 is not a quadratic residue mod 5 because the quadratic residues mod 5 are {0,1,4}, see A070430. 2 is not a quadratic residue mod 6 because the quadratic residues mod 6 are {0,1,3,4}, see A070431. 2 is a quadratic residue mod 7 because the quadratic residues mod 7 are {0,1,2,4}, see A053879. So a(3)=7. - R. J. Mathar, Jul 27 2015
MAPLE
A034796 := proc(n)
option remember;
if n = 1 then
1;
else
for a from procname(n-1)+1 do
if numtheory[quadres](procname(n-1), a) = 1 then
return a;
end if;
end do:
end if;
end proc: # R. J. Mathar, Jul 27 2015
MATHEMATICA
residueQ[n_, k_] := Length[ Select[ Range[ Floor[k/2]]^2, Mod[#, k] == n &, 1]] == 1; a[1] = 1; a[n_] := a[n] = For[k = a[n-1] + 1, True, k++, If[residueQ[a[n-1], k], Return[k]]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Aug 13 2013 *)
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
EXTENSIONS
Clarified definition, Joerg Arndt, Aug 14 2013
STATUS
approved