A001481 Numbers that are the sum of 2 squares.
0, 1, 2, 4, 5, 8, 9, 10, 13, 16, 17, 18, 20, 25, 26, 29, 32, 34, 36, 37, 40, 41, 45, 49, 50, 52, 53, 58, 61, 64, 65, 68, 72, 73, 74, 80, 81, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 121, 122, 125, 128, 130, 136, 137, 144, 145, 146, 148, 149, 153, 157, 160
Offset: 1
References
- J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
- David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
- L. Euler, (E388) Vollständige Anleitung zur Algebra, Zweiter Theil, reprinted in: Opera Omnia. Teubner, Leipzig, 1911, Series (1), Vol. 1, p. 417.
- S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 98-104.
- G. H. Hardy, Ramanujan, pp. 60-63.
- P. Moree and J. Cazaran, On a claim of Ramanujan in his first letter to Hardy, Expos. Math. 17 (1999), pp. 289-312.
- 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
- T. D. Noe, Table of n, a(n) for n = 1..10000
- Michael Baake, Uwe Grimm, Dieter Joseph and Przemyslaw Repetowicz, Averaged shelling for quasicrystals, arXiv:math/9907156 [math.MG], 1999.
- Chris Bispels, Matthew Cohen, Joshua Harrington, Joshua Lowrance, Kaelyn Pontes, Leif Schaumann, and Tony W. H. Wong, A further investigation on covering systems with odd moduli, arXiv:2507.16135 [math.NT], 2025. See p. 3.
- Henry Bottomley, Illustration of initial terms
- Richard T. Bumby, Sums of four squares, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.
- John Butcher, Quadratic residues and sums of two squares
- John Butcher, Sums of two squares revisited
- Leonhard Euler, Vollständige Anleitung zur Algebra, Zweiter Teil; see also Deutsches Textarchiv
- Steven R. Finch, Landau-Ramanujan Constant [broken link]
- Steven R. Finch, Landau-Ramanujan Constant [From the Wayback Machine]
- Steven R. Finch, On a Generalized Fermat-Wiles Equation [broken link]
- Steven R. Finch, On a Generalized Fermat-Wiles Equation [From the Wayback Machine]
- J. W. L. Glaisher, On the function which denotes the difference between the number of (4m+1)-divisors and the number of (4m+3)-divisors of a number, Proc. London Math. Soc., 15 (1884), 104-122. [Annotated scanned copy of pages 104-107 only]
- Leonor Godinho, Nicholas Lindsay, and Silvia Sabatini, On a symplectic generalization of a Hirzebruch problem, arXiv:2403.00949 [math.SG], 2024. See p. 17.
- Darij Grinberg, UMN Spring 2019 Math 4281 notes, University of Minnesota, College of Science & Engineering, 2019. [Wayback Machine copy]
- Shuo Li, The characteristic sequence of the integers that are the sum of two squares is not morphic, arXiv:2404.08822 [math.NT], 2024.
- Thomas Nickson and Igor Potapov, Broadcasting Automata and Patterns on Z^2, arXiv preprint arXiv:1410.0573 [cs.FL], 2014.
- Michael Penn, Sums of Squares, Youtube playlist, 2019, 2020.
- Peter Shiu, Counting Sums of Two Squares: The Meissel-Lehmer Method, Mathematics of Computation 47 (1986), 351-360.
- N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
- William A. Stein, Quadratic Forms:Sums of Two Squares
- Eric Weisstein's World of Mathematics, Square Number
- Eric Weisstein's World of Mathematics, Generalized Fermat Equation
- Eric Weisstein's World of Mathematics, Landau-Ramanujan Constant
- Eric Weisstein's World of Mathematics, Gaussian Integer
- A. van Wijngaarden, A table of partitions into two squares with an application to rational triangles, Proceedings of the Koninklijke Nederlandse Akademie van Wetenschappen, Series A, 53 (1950), 869-875.
- Gang Xiao, Two squares
- Index entries for sequences related to sums of squares
- Index entries for "core" sequences
Crossrefs
Programs
-
Haskell
a001481 n = a001481_list !! (n-1) a001481_list = [x | x <- [0..], a000161 x > 0] -- Reinhard Zumkeller, Feb 14 2012, Aug 16 2011
-
Magma
[n: n in [0..160] | NormEquation(1, n) eq true]; // Arkadiusz Wesolowski, May 11 2016
-
Maple
readlib(issqr): for n from 0 to 160 do for k from 0 to floor(sqrt(n)) do if issqr(n-k^2) then printf(`%d,`,n); break fi: od: od:
-
Mathematica
upTo = 160; With[{max = Ceiling[Sqrt[upTo]]}, Select[Union[Total /@ (Tuples[Range[0, max], {2}]^2)], # <= upTo &]] (* Harvey P. Dale, Apr 22 2011 *) Select[Range[0, 160], SquaresR[2, #] != 0 &] (* Jean-François Alcover, Jan 04 2013 *)
-
PARI
isA001481(n)=local(x,r);x=0;r=0;while(x<=sqrt(n) && r==0,if(issquare(n-x^2),r=1);x++);r \\ Michael B. Porter, Oct 31 2009
-
PARI
is(n)=my(f=factor(n));for(i=1,#f[,1],if(f[i,2]%2 && f[i,1]%4==3, return(0))); 1 \\ Charles R Greathouse IV, Aug 24 2012
-
PARI
B=bnfinit('z^2+1,1); is(n)=#bnfisintnorm(B,n) \\ Ralf Stephan, Oct 18 2013, edited by M. F. Hasler, Nov 21 2017
-
PARI
list(lim)=my(v=List(),t); for(m=0,sqrtint(lim\=1), t=m^2; for(n=0, min(sqrtint(lim-t),m), listput(v,t+n^2))); Set(v) \\ Charles R Greathouse IV, Jan 05 2016
-
PARI
is_A001481(n)=!for(i=2-bittest(n,0),#n=factor(n)~, bittest(n[1,i],1)&&bittest(n[2,i],0)&&return) \\ M. F. Hasler, Nov 20 2017
-
Python
from itertools import count, islice from sympy import factorint def A001481_gen(): # generator of terms return filter(lambda n:(lambda m:all(d & 3 != 3 or m[d] & 1 == 0 for d in m))(factorint(n)),count(0)) A001481_list = list(islice(A001481_gen(),30)) # Chai Wah Wu, Jun 27 2022
Formula
n = square * 2^{0 or 1} * {product of distinct primes == 1 (mod 4)}.
The number of integers less than N that are sums of two squares is asymptotic to constant*N/sqrt(log(N)), hence lim_{n->infinity} a(n)/n = infinity.
Nonzero terms in expansion of Dirichlet series Product_p (1 - (Kronecker(m, p) + 1)*p^(-s) + Kronecker(m, p)*p^(-2s))^(-1) for m = -1.
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533. - Charles R Greathouse IV, Apr 16 2012
There are B(x) = x/sqrt(log x) * (K + B2/log x + O(1/log^2 x)) terms of this sequence up to x, where K = A064533 and B2 = A227158. - Charles R Greathouse IV, Nov 18 2022
Extensions
Deleted an incorrect comment. - N. J. A. Sloane, Oct 03 2023
Comments