OFFSET
1,1
MATHEMATICA
a[1] = 2; squareModQ[p_, q_] := (For[k=0, k <= q, k++, If[Mod[p-k^2, q] == 0, Return[True]]]; Return[False]); a[n_] := a[n] = For[r=NextPrime[a[n-1]], True, r=NextPrime[r], If[And @@ (squareModQ[r, #] && squareModQ[#, r] & /@ Array[a, n-1]), Return[r]]]; Table[Print[a[n]]; a[n], {n, 1, 10}] (* Jean-François Alcover, Dec 10 2014 *)
PROG
(PARI) isok(newp, v, n) = {for (k=1, n, if (!issquare(Mod(newp, v[k])) || !issquare(Mod(v[k], newp)), return (0)); ); return (1); }
lista(nn) = {my(v=vector(nn), lastp=2); v[1] = lastp; for (n=2, nn, my(newp = nextprime(lastp+1)); while (! isok(newp, v, n-1), newp = nextprime(newp+1)); v[n] = newp; lastp = newp; ); v; } \\ Michel Marcus, Sep 25 2020
CROSSREFS
KEYWORD
nonn,nice,more
AUTHOR
EXTENSIONS
a(24)-a(29) from Sean A. Irvine, Sep 20 2020
Name edited by Michel Marcus, Sep 24 2020
STATUS
approved