login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A034698 a(n) is the smallest prime such that a(1), ..., a(n-1) are squares mod a(n). 3
2, 7, 31, 113, 233, 647, 1487, 4919, 6329, 7951, 26833, 47737, 53623, 128959, 135697, 142327, 1312777, 3178289, 6061607, 26564393, 32426081, 102958417, 209074609, 323901311, 587709359, 1006009759, 1029482303, 9876033449, 11061524183, 15821898167, 27926616007 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
MATHEMATICA
residueQ[n_, p_] := JacobiSymbol[n, p] == 1; a[1] = 2; a[n_] := a[n] = For[r = Range[n - 1]; p = NextPrime[a[n - 1]], True, p = NextPrime[p], If[AllTrue[r, residueQ[a[#], p] &], Return[p]]]; Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 24}] (* Jean-François Alcover, Feb 16 2018 *)
PROG
(Haskell)
a034698 n = a034698_list !! (n-1)
a034698_list = f [2..] [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
(PARI) first(n) = my(res=vector(n)); res[1]=2; for(x=2, n, forprime(p=res[x-1]+1, , for(y=1, x-1, if(!issquare(Mod(res[y], p)), next(2))); res[x]=p; break())); res \\ Iain Fox, Aug 08 2018
(PARI) nextterm(v) = forprime(p=v[#v]+1, , for(y=1, #v, if(!issquare(Mod(v[y], p)), next(2))); return(p)) \\ (Inserting a vector of the first n-1 terms will return the n-th term) Iain Fox, Aug 08 2018
CROSSREFS
Cf. A034700.
Sequence in context: A102162 A059846 A343532 * A115605 A289719 A114198
KEYWORD
nonn,nice
AUTHOR
E. M. Rains (rains(AT)caltech.edu)
EXTENSIONS
More terms from David W. Wilson
a(25)-a(28) from Iain Fox, Aug 08 2018
a(29)-a(30) from Iain Fox, Aug 09 2018
a(31) from Iain Fox, Aug 10 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 12:27 EDT 2024. Contains 371912 sequences. (Running on oeis4.)