A002313 Primes congruent to 1 or 2 modulo 4; or, primes of form x^2 + y^2; or, -1 is a square mod p.
2, 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 509, 521, 541, 557, 569, 577, 593, 601, 613, 617
Offset: 1
Examples
13 is in the sequence since it is prime and 13 = 4*3 + 1. Also 13 = 2^2 + 3^2. And -1 is a square (mod 13): -1 + 2*13 = 25 = 5^2. Of course, only the first term is congruent to 2 (mod 4). - _Michael B. Porter_, Jul 04 2016
References
- M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 872.
- David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
- G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- Zak Seidov, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
- Dario Alpern, Online program that calculates sum of squares representation
- N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
- J. Todd, A problem on arc tangent relations, Amer. Math. Monthly, 56 (1949), 517-528.
- Eric Weisstein's World of Mathematics, Fermat's 4n+1 Theorem
- G. Xiao, Two squares
- Index entries for Gaussian integers and primes
Crossrefs
Programs
-
Haskell
a002313 n = a002313_list !! (n-1) a002313_list = filter ((`elem` [1,2]) . (`mod` 4)) a000040_list -- Reinhard Zumkeller, Feb 04 2014
-
Magma
[p: p in PrimesUpTo(700) | p mod 4 in {1,2}]; // Vincenzo Librandi, Feb 18 2015
-
Maple
with(numtheory): for n from 1 to 300 do if ithprime(n) mod 4 = 1 or ithprime(n) mod 4 = 2 then printf(`%d,`,ithprime(n)) fi; od: # alternative A002313 := proc(n) option remember ; local a; if n = 1 then 2; elif n = 2 then 5; else for a from procname(n-1)+4 by 4 do if isprime(a) then return a ; end if; end do: end if; end proc: seq(A002313(n),n=1..100) ; # R. J. Mathar, Feb 01 2024
-
Mathematica
Select[ Prime@ Range@ 115, Mod[#, 4] != 3 &] (* Robert G. Wilson v *) fQ[n_] := Solve[x^2 + 1 == n*y^2, {x, y}, Integers] == {}; Select[ Prime@ Range@ 115, fQ] (* Robert G. Wilson v, Dec 19 2013 *)
-
PARI
select(p->p%4!=3, primes(1000)) \\ Charles R Greathouse IV, Feb 11 2011
Formula
a(n) ~ 2n log n. - Charles R Greathouse IV, Jul 04 2016
Extensions
More terms from Henry Bottomley, Aug 10 2000
More terms from James Sellers, Aug 22 2000
Comments