OFFSET
1,3
REFERENCES
A. J. C. Cunningham, Quadratic Partitions. Hodgson, London, 1904, p. 1.
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
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
A. T. Benjamin and D. Zeilberger, Pythagorean primes and palindromic continued fractionsINTEGERS 5(1) (2005) #A30
John Brillhart, Note on representing a prime as a sum of two squares, Math. Comp. 26 (1972), pp. 1011-1013.
A. J. C. Cunningham, Quadratic Partitions, Hodgson, London, 1904. [Annotated scans of selected pages]
K. Matthews, Serret's algorithm Server.
J. Todd, A problem on arc tangent relations, Amer. Math. Monthly, 56 (1949), 517-528.
Eric Weisstein's World of Mathematics, Fermat's 4n Plus 1 Theorem.
FORMULA
EXAMPLE
The following table shows the relationship
between several closely related sequences:
Here p = A002144 = primes == 1 (mod 4), p = a^2+b^2 with a < b;
with {c,d} = {t_2, t_3}, t_4 = cd/2 = ab(b^2-a^2).
---------------------------------
.p..a..b..t_1..c...d.t_2.t_3..t_4
---------------------------------
.5..1..2...1...3...4...4...3....6
13..2..3...3...5..12..12...5...30
17..1..4...2...8..15...8..15...60
29..2..5...5..20..21..20..21..210
37..1..6...3..12..35..12..35..210
41..4..5..10...9..40..40...9..180
53..2..7...7..28..45..28..45..630
.................................
MAPLE
MATHEMATICA
pmax = 1000; x[p_] := Module[{x, y}, x /. ToRules[Reduce[0 <= x <= y && x^2 + y^2 == p, {x, y}, Integers]]]; For[n=1; p=2, p<pmax, p = NextPrime[p], If[Mod[p, 4] == 1 || Mod[p, 4] == 2, a[n] = x[p]; Print["a(", n, ") = ", a[n]]; n++]]; Array[a, n-1] (* Jean-François Alcover, Feb 26 2016 *)
PROG
(PARI) f(p)=my(s=lift(sqrt(Mod(-1, p))), x=p, t); if(s>p/2, s=p-s); while(s^2>p, t=s; s=x%s; x=t); s
forprime(p=2, 1e3, if(p%4-3, print1(sqrtint(p-f(p)^2)", ")))
\\ Charles R Greathouse IV, Apr 24 2012
(PARI) do(p)=qfbsolve(Qfb(1, 0, 1), p)[2]
forprime(p=2, 1e3, if(p%4-3, print1(do(p)", "))) \\ Charles R Greathouse IV, Sep 26 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved