This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A002331 M0096 N0033 #53 May 12 2025 23:33:09 %S A002331 1,1,2,1,2,1,4,2,5,3,5,4,1,3,7,4,7,6,2,9,7,1,2,8,4,1,10,9,5,2,12,11,9, %T A002331 5,8,7,10,6,1,3,14,12,7,4,10,5,11,10,14,13,1,8,5,17,16,4,13,6,12,1,5, %U A002331 15,2,9,19,12,17,11,5,14,10,18,4,6,16,20,19,10,13,4,6,15,22,11,3,5 %N A002331 Values of x in the solution to p = x^2 + y^2, x <= y, with prime p = A002313(n). %D A002331 A. J. C. Cunningham, Quadratic Partitions. Hodgson, London, 1904, p. 1. %D A002331 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence). %D A002331 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A002331 Charles R Greathouse IV, <a href="/A002331/b002331.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe) %H A002331 A. T. Benjamin and D. Zeilberger, <a href="https://www.emis.de/journals/INTEGERS/papers/f30/f30.Abstract.html">Pythagorean primes and palindromic continued fractions</a>INTEGERS 5(1) (2005) #A30 %H A002331 John Brillhart, <a href="http://dx.doi.org/10.1090/S0025-5718-1972-0314745-6">Note on representing a prime as a sum of two squares</a>, Math. Comp. 26 (1972), pp. 1011-1013. %H A002331 A. J. C. Cunningham, <a href="/A002330/a002330.pdf">Quadratic Partitions</a>, Hodgson, London, 1904. [Annotated scans of selected pages] %H A002331 K. Matthews, <a href="http://www.numbertheory.org/php/serret.html">Serret's algorithm Server</a>. %H A002331 J. Todd, <a href="http://www.jstor.org/stable/2305526">A problem on arc tangent relations</a>, Amer. Math. Monthly, 56 (1949), 517-528. %H A002331 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Fermats4nPlus1Theorem.html">Fermat's 4n Plus 1 Theorem</a>. %F A002331 a(n) = A096029(n) - A096030(n) for n > 1. - _Lekraj Beedassy_, Jul 16 2004 %F A002331 a(n+1) = Min(A002972(n), 2*A002973(n)). - _Reinhard Zumkeller_, Feb 16 2010 %F A002331 a(n) = A363051(A002313(n)). - _R. J. Mathar_, Jan 31 2024 %e A002331 The following table shows the relationship between several closely related sequences: %e A002331 Here p = A002144 = primes == 1 (mod 4), p = a^2+b^2 with a < b; %e A002331 a = A002331, b = A002330, t_1 = ab/2 = A070151; %e A002331 p^2 = c^2+d^2 with c < d; c = A002366, d = A002365, %e A002331 t_2 = 2ab = A145046, t_3 = b^2-a^2 = A070079, %e A002331 with {c,d} = {t_2, t_3}, t_4 = cd/2 = ab(b^2-a^2). %e A002331 --------------------------------- %e A002331 .p..a..b..t_1..c...d.t_2.t_3..t_4 %e A002331 --------------------------------- %e A002331 .5..1..2...1...3...4...4...3....6 %e A002331 13..2..3...3...5..12..12...5...30 %e A002331 17..1..4...2...8..15...8..15...60 %e A002331 29..2..5...5..20..21..20..21..210 %e A002331 37..1..6...3..12..35..12..35..210 %e A002331 41..4..5..10...9..40..40...9..180 %e A002331 53..2..7...7..28..45..28..45..630 %e A002331 ................................. %p A002331 See A002330 for Maple program. %p A002331 # alternative %p A002331 A002331 := proc(n) %p A002331 A363051(A002313(n)) ; %p A002331 end proc: %p A002331 seq(A002331(n),n=1..100) ; # _R. J. Mathar_, Feb 01 2024 %t A002331 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 *) %o A002331 (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 %o A002331 forprime(p=2,1e3,if(p%4-3,print1(sqrtint(p-f(p)^2)", "))) %o A002331 \\ _Charles R Greathouse IV_, Apr 24 2012 %o A002331 (PARI) do(p)=qfbsolve(Qfb(1,0,1),p)[2] %o A002331 forprime(p=2,1e3,if(p%4-3,print1(do(p)", "))) \\ _Charles R Greathouse IV_, Sep 26 2013 %Y A002331 Cf. A002330, A002313, A002144, A027862 (locates y=x+1). %K A002331 nonn %O A002331 1,3 %A A002331 _N. J. A. Sloane_