OFFSET
1,1
COMMENTS
a(n) is also smallest prime == 1 (mod 4) such that a(i) is a square mod a(n), all i<n. Thus each a(i) is a square mod each a(j), i<>j.
MATHEMATICA
next[p_] := If[ Mod[np = NextPrime[p], 4] != 1, next[np], np]; s = {next[2]}; Print[ s[[1]] ]; squareModQ[p_, q_] := (Reduce[ Mod[p - x^2, q] == 0, x, Integers] =!= False); ok[p_] := (r = True; Do[ If[ squareModQ[p, s[[k]] ] === False, r = False; Break[] ], {k, 1, Length[s]} ]; r); grow := (p = next[ Last[s] ]; While[ ok[p] === False, p = next[p] ]; Print[p]; AppendTo[s, p]); Do[ grow, {24} ]; A034700 = s (* Jean-François Alcover, Apr 04 2012 *)
PROG
(Haskell)
a034700 n = a034700_list !! (n-1)
a034700_list = f [1, 5..] [1] where
f (x:xs) ys | a010051' x == 1 &&
(and $ map (isSquMod x) ys) = x : f xs (x:ys)
| otherwise = f xs ys
isSquMod u v = v `mod` u `elem` (map ((`mod` u) . (^ 2)) [0..u-1])
-- Reinhard Zumkeller, Mar 28 2012
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
E. M. Rains (rains(AT)caltech.edu)
EXTENSIONS
More terms from David W. Wilson
a(26)-a(31) from Giovanni Resta, Aug 09 2018
STATUS
approved