OFFSET
1,1
LINKS
Giovanni Resta and Charles R Greathouse IV, Table of n, a(n) for n = 1..10000 (first 5000 terms from Giovanni Resta)
Joshua Harrington, Lenny Jones, and Alicia Lamarche, Representing integers as the sum of two squares in the ring Z_n, arXiv:1404.0187 (2014) and J. Int. Seq. 17 (2014) # 14.7.4.
EXAMPLE
13 is a member since 0=1^2+5^2, 1=2^2+6^2, 2=1^2+1^2, 3=2^2+5^2, 4=1^2+4^2, 5=1^2+2^2, 6=3^2+6^2, 7=2^2+4^2, 8=2^2+2^2, 9=5^2+6^2, 10=1^2+3^2, 11=1^2+6^2, and 12=3^2+4^2 mod 13.
5 is not a member since there are no nonzero x and y such that x^2 + y^2 = 4 (mod 5).
MATHEMATICA
ok[n_] := Block[{t = Union@ Select[Mod[ Range[n]^2, n], # > 0 &], f = Range[n] 0}, Do[ f[[1 + Mod[t[[i]] + t[[j]], n]]]++, {i, Length@t}, {j, i}]; Position[f, 0] == {}]; Select[Range[2, 200], ok] (* Giovanni Resta, Apr 01 2014 *)
PROG
(PARI) is(n)=my(f=factor(n), P=#select(k->k%4==1, f[, 1])); if(P==0, return(0)); for(i=1, #f~, if(f[i, 2]>1 && f[i, 1]%4>1, return(0))); P>1 || n%2==0 || n%5 || n%125==0 \\ Charles R Greathouse IV, Apr 04 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Lenny Jones, Mar 30 2014
STATUS
approved