cp's OEIS Frontend

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.

Showing 1-10 of 11 results. Next

A001481 Numbers that are the sum of 2 squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Numbers n such that n = x^2 + y^2 has a solution in nonnegative integers x, y.
Closed under multiplication. - David W. Wilson, Dec 20 2004
Also, numbers whose cubes are the sum of 2 squares. - Artur Jasinski, Nov 21 2006 (Cf. A125110.)
Terms are the squares of smallest radii of circles covering (on a square grid) a number of points equal to the terms of A057961. - Philippe Lallouet (philip.lallouet(AT)wanadoo.fr), Apr 16 2007. [Comment corrected by T. D. Noe, Mar 28 2008]
Numbers with more 4k+1 divisors than 4k+3 divisors. If a(n) is a member of this sequence, then so too is any power of a(n). - Ant King, Oct 05 2010
A000161(a(n)) > 0; A070176(a(n)) = 0. - Reinhard Zumkeller, Feb 04 2012, Aug 16 2011
Numbers that are the norms of Gaussian integers. This sequence has unique factorization; the primitive elements are A055025. - Franklin T. Adams-Watters, Nov 25 2011
These are numbers n such that all of n's odd prime factors congruent to 3 modulo 4 occur to an even exponent (Fermat's two-squares theorem). - Jean-Christophe Hervé, May 01 2013
Let's say that an integer n divides a lattice if there exists a sublattice of index n. Example: 2, 4, 5 divide the square lattice. The present sequence without 0 is the sequence of divisors of the square lattice. Say that n is a "prime divisor" if the index-n sublattice is not contained in any other sublattice except the original lattice itself. Then A055025 (norms of Gaussian primes) gives the "prime divisors" of the square lattice. - Jean-Christophe Hervé, May 01 2013
For any i,j > 0 a(i)*a(j) is a member of this sequence, since (a^2 + b^2)*(c^2 + d^2) = (a*c + b*d)^2 + (a*d - b*c)^2. - Boris Putievskiy, May 05 2013
The sequence is closed under multiplication. Primitive elements are in A055025. The sequence can be split into 3 multiplicatively closed subsequences: {0}, A004431 and A125853. - Jean-Christophe Hervé, Nov 17 2013
Generalizing Jasinski's comment, same as numbers whose odd powers are the sum of 2 squares, by Fermat's two-squares theorem. - Jonathan Sondow, Jan 24 2014
By the 4 squares theorem, every nonnegative integer can be expressed as the sum of two elements of this sequence. - Franklin T. Adams-Watters, Mar 28 2015
There are never more than 3 consecutive terms. Runs of 3 terms start at 0, 8, 16, 72, ... (A082982). - Ivan Neretin, Nov 09 2015
Conjecture: barring the 0+2, 0+4, 0+8, 0+16, ... sequence, the sum of 2 distinct terms in this sequence is never a power of 2. - J. Lowell, Jan 14 2022
All the areas of squares whose vertices have integer coordinates. - Neeme Vaino, Jun 14 2023
Numbers represented by the definite binary quadratic forms x^2 + 2nxy + (n^2+1)y^2 for any integer n. This sequence contains the even powers of any integer. An odd power of a number appears only if the number itself belongs to the sequence. The equation given in the comment by Boris Putievskiy 2013 is Brahmagupta's identity with n = 1. It proves that any set of numbers of the form a^2 + nb^2 is closed under multiplication. - Klaus Purath, Sep 06 2023

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).

Crossrefs

Disjoint union of A000290 and A000415.
Complement of A022544.
A000404 gives another version. Subsequence of A091072, supersequence of A046711.
Column k=2 of A336820.

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

A000404 Numbers that are the sum of 2 nonzero squares.

Original entry on oeis.org

2, 5, 8, 10, 13, 17, 18, 20, 25, 26, 29, 32, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 72, 73, 74, 80, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 122, 125, 128, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 162, 164, 169, 170, 173, 178
Offset: 1

Views

Author

Keywords

Comments

From the formula it is easy to see that if k is in this sequence, then so are all odd powers of k. - T. D. Noe, Jan 13 2009
Also numbers whose cubes are the sum of two nonzero squares. - Joe Namnath and Lawrence Sze
A line perpendicular to y=mx has its first integral y-intercept at a^2+b^2. The remaining ones for that slope are multiples of that primitive value. - Larry J Zimmermann, Aug 19 2010
The primes in this sequence are sequence A002313.
Complement of A018825; A025426(a(n)) > 0; A063725(a(n)) > 0. - Reinhard Zumkeller, Aug 16 2011
If the two squares are not equal, then any power is still in the sequence: if k = x^2 + y^2 with x != y, then k^2 = (x^2-y^2)^2 + (2xy)^2 and k^3 = (x(x^2-3y^2))^2 + (y(3x^2-y^2))^2, etc. - Carmine Suriano, Jul 13 2012
There are never more than 3 consecutive terms that differ by 1. Triples of consecutive terms that differ by 1 occur infinitely many times, for example, 2(k^2 + k)^2, (k^2 - 1)^2 + (k^2 + 2 k)^2, and (k^2 + k - 1)^2 + (k^2 + k + 1)^2 for any integer k > 1. - Ivan Neretin, Mar 16 2017 [Corrected by Jerzy R Borysowicz, Apr 14 2017]
Number of terms less than 10^k, k=1,2,3,...: 3, 34, 308, 2690, 23873, 215907, 1984228, ... - Muniru A Asiru, Feb 01 2018
The squares in this sequence are the squares of the so-called hypotenuse numbers A009003. - M. F. Hasler, Jun 20 2025

Examples

			25 = 3^2 + 4^2, therefore 25 is a term. Note that also 25^3 = 15625 = 44^2 + 117^2, therefore 15625 is a term.
		

References

  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 103.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 75, Theorem 4, with Theorem 2, p. 15.
  • 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.
  • Ian Stewart, "Game, Set and Math", Chapter 8, 'Close Encounters of the Fermat Kind', Penguin Books, Ed. 1991, pp. 107-124.

Crossrefs

A001481 gives another version (allowing for zero squares).
Cf. A004431 (2 distinct squares), A063725 (number of representations), A024509 (numbers with multiplicity), A025284, A018825. Also A050803, A050801, A001105, A033431, A084888, A000578, A000290, A057961, A232499, A007692.
Cf. A003325 (analog for cubes), A003336 (analog for 4th powers).
Cf. A009003 (square roots of the squares in this sequence).
Column k=2 of A336725.

Programs

  • GAP
    P:=List([1..10^4],i->i^2);;
    A000404 := Set(Flat(List(P, i->List(P, j -> i+j)))); # Muniru A Asiru, Feb 01 2018
    
  • Haskell
    import Data.List (findIndices)
    a000404 n = a000404_list !! (n-1)
    a000404_list = findIndices (> 0) a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Magma
    lst:=[]; for n in [1..178] do f:=Factorization(n); if IsSquare(n) then for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 1 then Append(~lst, n); break; end if; end for; else t:=0; for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 3 and d[2] mod 2 eq 1 then t:=1; break; end if; end for; if t eq 0 then Append(~lst, n); end if; end if; end for; lst; // Arkadiusz Wesolowski, Feb 16 2017
    
  • Maple
    nMax:=178: A:={}: for i to floor(sqrt(nMax)) do for j to floor(sqrt(nMax)) do if i^2+j^2 <= nMax then A := `union`(A, {i^2+j^2}) else  end if end do end do: A; # Emeric Deutsch, Jan 02 2017
  • Mathematica
    nMax=1000; n2=Floor[Sqrt[nMax-1]]; Union[Flatten[Table[a^2+b^2, {a,n2}, {b,a,Floor[Sqrt[nMax-a^2]]}]]]
    Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {0, } -> Nothing] > 0 &] (* _Michael De Vlieger, Mar 24 2016 *)
    Module[{upto=200},Select[Union[Total/@Tuples[Range[Sqrt[upto]]^2,2]],#<= upto&]] (* Harvey P. Dale, Sep 18 2021 *)
  • PARI
    is_A000404(n)= for( i=1,#n=factor(n)~%4, n[1,i]==3 && n[2,i]%2 && return); n && ( vecmin(n[1,])==1 || (n[1,1]==2 && n[2,1]%2)) \\ M. F. Hasler, Feb 07 2009
    
  • PARI
    list(lim)=my(v=List(),x2); lim\=1; for(x=1,sqrtint(lim-1), x2=x^2; for(y=1,sqrtint(lim-x2), listput(v,x2+y^2))); Set(v) \\ Charles R Greathouse IV, Apr 30 2016
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A000404_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            c = False
            for p in (f:=factorint(n)):
                if (q:= p & 3)==3 and f[p]&1:
                    break
                elif q == 1:
                    c = True
            else:
                if c or f.get(2,0)&1:
                    yield n
    A000404_list = list(islice(A000404_gen(),30)) # Chai Wah Wu, Jul 01 2022

Formula

Let k = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 * ... * q_s^b_s with t >= 0, a_i >= 0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j == -1 (mod 4) for j=1..s. Then k is a term iff 1) b_j == 0 (mod 2) for j=1..s and 2) r > 0 or t == 1 (mod 2) (or both).
From Charles R Greathouse IV, Nov 18 2022: (Start)
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533.
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. (End)

Extensions

Edited by Ralf Stephan, Nov 15 2004
Typo in formula corrected by M. F. Hasler, Feb 07 2009
Erroneous Mathematica program fixed by T. D. Noe, Aug 07 2009
PARI code fixed for versions > 2.5 by M. F. Hasler, Jan 01 2013

A004018 Theta series of square lattice (or number of ways of writing n as a sum of 2 squares). Often denoted by r(n) or r_2(n).

Original entry on oeis.org

1, 4, 4, 0, 4, 8, 0, 0, 4, 4, 8, 0, 0, 8, 0, 0, 4, 8, 4, 0, 8, 0, 0, 0, 0, 12, 8, 0, 0, 8, 0, 0, 4, 0, 8, 0, 4, 8, 0, 0, 8, 8, 0, 0, 0, 8, 0, 0, 0, 4, 12, 0, 8, 8, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 4, 16, 0, 0, 8, 0, 0, 0, 4, 8, 8, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 16, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 8, 4, 0, 12, 8
Offset: 0

Views

Author

Keywords

Comments

Number of points in square lattice on the circle of radius sqrt(n). Equivalently, number of Gaussian integers of norm n (cf. Conway-Sloane, p. 106).
Let b(n)=A004403(n), then Sum_{k=1..n} a(k)*b(n-k) = 1. - John W. Layman
Theta series of D_2 lattice.
Number 6 of the 74 eta-quotients listed in Table I of Martin (1996).
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
The zeros in this sequence correspond to those integers with an equal number of 4k+1 and 4k+3 divisors, or equivalently to those that have at least one 4k+3 prime factor with an odd exponent (A022544). - Ant King, Mar 12 2013
If A(q) = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + ... denotes the o.g.f. of this sequence then the function F(q) := 1/4*(A(q^2) - A(q^4)) = ( Sum_{n >= 0} q^(2*n+1)^2 )^2 is the o.g.f. for counting the ways a positive integer n can be written as the sum of two positive odd squares. - Peter Bala, Dec 13 2013
Expansion coefficients of (2/Pi)*K, with the real quarter period K of elliptic functions, as series of the Jacobi nome q, due to (2/Pi)*K = theta_3(0,q)^2. See, e.g., Whittaker-Watson, p. 486. - Wolfdieter Lang, Jul 15 2016
Sum_{k=0..n} a(n) = A057655(n). Robert G. Wilson v, Dec 22 2016
Limit_{n->oo} (a(n)/n - Pi*log(n)) = A062089: Sierpinski's constant. - Robert G. Wilson v, Dec 22 2016
The mean value of a(n) is Pi, see A057655 for more details. - M. F. Hasler, Mar 20 2017

Examples

			G.f. = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + 4*q^8 + 4*q^9 + 8*q^10 + 8*q^13 + 4*q^16 + 8*q^17 + 4*q^18 + 8*q^20 + 12*q^25 + 8*q^26 + ... . - _John Cannon_, Dec 30 2006
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 162, #16 (7), r(n).
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.23).
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 15, p. 32, Lemma 2 (with the proof), p. 116, (9.10) first formula.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 133.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 240, r(n).
  • W. König and J. Sprekels, Karl Weierstraß (1815-1897), Springer Spektrum, Wiesbaden, 2016, p. 186-187 and p. 280-281.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 51.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 244-245.
  • E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, fourth edition, reprinted, 1958, Cambridge at the University Press.

Crossrefs

Row d=2 of A122141 and of A319574, 2nd column of A286815.
Partial sums - 1 give A014198.
A071385 gives records; A071383 gives where records occur.

Programs

  • Julia
    # JacobiTheta3 is defined in A000122.
    A004018List(len) = JacobiTheta3(len, 2)
    A004018List(102) |> println # Peter Luschny, Mar 12 2018
    
  • Magma
    Basis( ModularForms( Gamma1(4), 1), 100) [1]; /* Michael Somos, Jun 10 2014 */
    
  • Maple
    (sum(x^(m^2),m=-10..10))^2;
    # Alternative:
    A004018list := proc(len) series(JacobiTheta3(0, x)^2, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end:
    t1 := A004018list(102);
    r2 := n -> t1[n+1]; # Peter Luschny, Oct 02 2018
  • Mathematica
    SquaresR[2,Range[0,110]] (* Harvey P. Dale, Oct 10 2011 *)
    a[ n_] := SquaresR[ 2, n]; (* Michael Somos, Nov 15 2011 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^2, {q, 0, n}]; (* Michael Somos, Nov 15 2011 *)
    a[ n_] := With[{m = InverseEllipticNomeQ @ q}, SeriesCoefficient[ EllipticK[ m] / (Pi/2), {q, 0, n}]]; (* Michael Somos, Jun 10 2014 *)
    a[ n_] := If[ n < 1, Boole[n == 0], 4 Sum[ KroneckerSymbol[-4, d], {d, Divisors@n}]]; (* or *) a[ n_] := SeriesCoefficient[ QPochhammer[ q^2]^10/(QPochhammer[ q] QPochhammer[ q^4])^4, {q, 0, n}]; (* Michael Somos, May 17 2015 *)
  • PARI
    {a(n) = polcoeff( 1 + 4 * sum( k=1, n, x^k / (1 + x^(2*k)), x * O(x^n)), n)}; /* Michael Somos, Mar 14 2003 */
    
  • PARI
    {a(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)))}; /* Michael Somos, Jul 19 2004 */
    
  • PARI
    {a(n) = if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 1], n)[n])}; /* Michael Somos, May 13 2005 */
    
  • PARI
    a(n)=if(n==0,return(1)); my(f=factor(n)); 4*prod(i=1,#f~, if(f[i,1]%4==1, f[i,2]+1, if(f[i,2]%2 && f[i,1]>2, 0, 1))) \\ Charles R Greathouse IV, Sep 02 2015
    
  • Python
    from sympy import factorint
    def a(n):
        if n == 0: return 1
        an = 4
        for pi, ei in factorint(n).items():
           if pi%4 == 1: an *= ei+1
           elif pi%4 == 3 and ei%2: return 0
        return an
    print([a(n) for n in range(102)]) # Michael S. Branicky, Sep 24 2021
    
  • Python
    from math import prod
    from sympy import factorint
    def A004018(n): return prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in factorint(n).items())<<2 if n else 1 # Chai Wah Wu, Jul 07 2022, corrected Jun 21 2024.
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*2)
    Q.representation_number_list(102) # Peter Luschny, Jun 20 2014
    

Formula

Expansion of theta_3(q)^2 = (Sum_{n=-oo..+oo} q^(n^2))^2 = Product_{m>=1} (1-q^(2*m))^2 * (1+q^(2*m-1))^4; convolution square of A000122.
Factor n as n = p1^a1 * p2^a2 * ... * q1^b1 * q2^b2 * ... * 2^c, where the p's are primes == 1 (mod 4) and the q's are primes == 3 (mod 4). Then a(n) = 0 if any b is odd, otherwise a(n) = 4*(1 + a1)*(1 + a2)*...
G.f. = s(2)^10/(s(1)^4*s(4)^4), where s(k) := subs(q=q^k, eta(q)) and eta(q) is Dedekind's function, cf. A010815. [Fine]
a(n) = 4*A002654(n), n > 0.
Expansion of eta(q^2)^10 / (eta(q) * eta(q^4))^4 in powers of q. - Michael Somos, Jul 19 2004
Expansion of ( phi(q)^2 + phi(-q)^2 ) / 2 in powers of q^2 where phi() is a Ramanujan theta function.
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (u - v)^2 - (v - w) * 4 * w. - Michael Somos, Jul 19 2004
Euler transform of period 4 sequence [4, -6, 4, -2, ...]. - Michael Somos, Jul 19 2004
Moebius transform is period 4 sequence [4, 0, -4, 0, ...]. - Michael Somos, Sep 17 2007
G.f. is a period 1 Fourier series which satisfies f(-1 / (4 t)) = 2 (t/i) f(t) where q = exp(2 Pi i t).
The constant sqrt(Pi)/Gamma(3/4)^2 produces the first 324 terms of the sequence when expanded in base exp(Pi), 450 digits of the constant are necessary. - Simon Plouffe, Mar 03 2011
a(n) = A004531(4*n). a(n) = 2*A105673(n), if n>0.
Let s = 16*q*(E1*E4^2/E2^3)^8 where Ek = Product_{n>=1} (1-q^(k*n)) (s=k^2 where k is elliptic k), then the g.f. is hypergeom([+1/2, +1/2], [+1], s) (expansion of 2/Pi*ellipticK(k) in powers of q). - Joerg Arndt, Aug 15 2011
Dirichlet g.f. Sum_{n>=1} a(n)/n^s = 4*zeta(s)*L_(-4)(s), where L is the D.g.f. of the (shifted) A056594. [Raman. J. 7 (2003) 95-127]. - R. J. Mathar, Jul 02 2012
a(n) = floor(1/(n+1)) + 4*floor(cos(Pi*sqrt(n))^2) - 4*floor(cos(Pi*sqrt(n/2))^2) + 8*Sum_{i=1..floor(n/2)} floor(cos(Pi*sqrt(i))^2)*floor(cos(Pi*sqrt(n-i))^2). - Wesley Ivan Hurt, Jan 09 2013
From Wolfdieter Lang, Aug 01 2016: (Start)
A Jacobi identity: theta_3(0, q)^2 = 1 + 4*Sum_{r>=0} (-1)^r*q^(2*r+1)/(1 - q^(2*r+1)). See, e.g., the Grosswald reference (p. 15, p. 116, but p. 32, Lemma 2 with the proof, has the typo r >= 1 instead of r >= 0 in the sum, also in the proof). See the link with the Jacobi-Legendre letter.
Identity used by Weierstraß (see the König-Sprekels book, p. 187, eq. (5.12) and p. 281, with references, but there F(x) from (5.11) on p. 186 should start with nu =1 not 0): theta_3(0, q)^2 = 1 + 4*Sum_{n>=1} q^n/(1 + q^(2*n)). Proof: similar to the one of the preceding Jacobi identity. (End)
a(n) = (4/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
G.f.: Theta_3(q)^2 = hypergeometric([1/2, 1/2],[1],lambda(q)), with lambda(q) = Sum_{j>=1} A115977(j)*q^j. See the Kontsevich and Zagier link, with Theta -> Theta_3, z -> 2*z and q -> q^2. - Wolfdieter Lang, May 27 2018

A057655 The circle problem: number of points (x,y) in square lattice with x^2 + y^2 <= n.

Original entry on oeis.org

1, 5, 9, 9, 13, 21, 21, 21, 25, 29, 37, 37, 37, 45, 45, 45, 49, 57, 61, 61, 69, 69, 69, 69, 69, 81, 89, 89, 89, 97, 97, 97, 101, 101, 109, 109, 113, 121, 121, 121, 129, 137, 137, 137, 137, 145, 145, 145, 145, 149, 161, 161, 169, 177, 177, 177
Offset: 0

Views

Author

N. J. A. Sloane, Oct 15 2000

Keywords

Examples

			a(0) = 1 (counting origin).
a(1) = 5 since 4 points lie on the circle of radius sqrt(1) + origin.
a(2) = 9 since 4 lattice points lie on the circle w/radius = sqrt(2) (along diagonals) + 4 points inside the circle + origin. - _Wesley Ivan Hurt_, Jan 10 2013
		

References

  • C. Alsina and R. B. Nelsen, Charming Proofs: A Journey Into Elegant Mathematics, Math. Assoc. Amer., 2010, p. 42.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • F. Fricker, Einfuehrung in die Gitterpunktlehre, Birkhäuser, Boston, 1982.
  • P. de la Harpe, Topics in Geometric Group Theory, Univ. Chicago Press, 2000, p. 5.
  • E. Kraetzel, Lattice Points, Kluwer, Dordrecht, 1988.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 51.
  • W. Sierpiński, Elementary Theory of Numbers, Elsevier, North-Holland, 1988.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 245-246.

Crossrefs

Partial sums of A004018. Cf. A014198, A057656, A057961, A057962, A122510. For another version see A000328.
Cf. A038589 (for hexagonal lattice).

Programs

  • Haskell
    a057655 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 <= n]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Maple
    N:= 1000: # to get a(0) to a(N)
    R:= Array(0..N):
    for a from 0 to floor(sqrt(N)) do
      for b from 0 to floor(sqrt(N-a^2)) do
        r:= a^2 + b^2;
        R[r]:= R[r] + (2 - charfcn[0](a))*(2 - charfcn[0](b));
      od
    od:
    convert(map(round,Statistics:-CumulativeSum(R)),list); # Robert Israel, Sep 29 2014
  • Mathematica
    f[n_] := 1 + 4Sum[ Floor@ Sqrt[n - k^2], {k, 0, Sqrt[n]}]; Table[ f[n], {n, 0, 60}] (* Robert G. Wilson v, Jun 16 2006 *)
    Accumulate[ SquaresR[2, Range[0, 55]]] (* Jean-François Alcover, Feb 24 2012 *)
    CoefficientList[Series[EllipticTheta[3,0,x]^2/(1-x), {x, 0, 100}], x] (* Vaclav Kotesovec, Sep 29 2014 after Robert Israel *)
  • PARI
    a(n)=sum(x=-n,n,sum(y=-n,n,if((sign(x^2+y^2-n)+1)*sign(x^2+y^2-n),0,1)))
    
  • PARI
    a(n)=1+4*sum(k=0,sqrtint(n), sqrtint(n-k^2) ); /* Benoit Cloitre, Oct 08 2012 */
    
  • Python
    from math import isqrt
    def A057655(n): return 1+(sum(isqrt(n-k**2) for k in range(isqrt(n)+1))<<2) # Chai Wah Wu, Jul 31 2023

Formula

a(n) = 1 + 4*{ [n/1] - [n/3] + [n/5] - [n/7] + ... }. - Gauss
a(n) = 1 + 4*Sum_{ k = 0 .. [sqrt(n)] } [ sqrt(n-k^2) ]. - Liouville (?)
a(n) - Pi*n = O(sqrt(n)) (Gauss). a(n) - Pi*n = O(n^c), c = 23/73 + epsilon ~ 0.3151 (Huxley). If a(n) - Pi*n = O(n^c) then c > 1/4 (Landau, Hardy). It is conjectured that a(n) - Pi*n = O(n^(1/4 + epsilon)) for all epsilon > 0.
a(n) = A014198(n) + 1.
a(n) = A122510(2,n). - R. J. Mathar, Apr 21 2010
a(n) = 1 + sum((floor(1/(k+1)) + 4 * floor(cos(Pi * sqrt(k))^2) - 4 * floor(cos(Pi * sqrt(k/2))^2) + 8 * sum((floor(cos(Pi * sqrt(i))^2) * floor(cos(Pi * sqrt(k-i))^2)), i = 1..floor(k/2))), k = 1..n). - Wesley Ivan Hurt, Jan 10 2013
G.f.: theta_3(0,x)^2/(1-x) where theta_3 is a Jacobi theta function. - Robert Israel, Sep 29 2014
a(n^2) = A000328(n). - R. J. Mathar, Aug 03 2025

A232499 Number of unit squares, aligned with a Cartesian grid, completely within the first quadrant of a circle centered at the origin ordered by increasing radius.

Original entry on oeis.org

1, 3, 4, 6, 8, 10, 11, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30, 33, 35, 37, 39, 41, 45, 47, 48, 50, 52, 54, 56, 60, 62, 64, 66, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 89, 90, 94, 96, 98, 102, 104, 106, 108, 110, 112, 114, 115, 117, 119, 123, 125, 127, 129, 131
Offset: 1

Views

Author

Rajan Murthy and Vale Murthy, Nov 24 2013

Keywords

Comments

The interval between terms reflects the number of ways a square integer can be partitioned into the sum of two square integers in an ordered pair. As examples, the increase from a(1) to a(2) from 1 to 3 is due to the inclusion of (1,2) and (2,1); and the increase from a(2) to a(3) is due to the inclusion of (2,2). Larger intervals occur when there are more combinations, such as, between a(17) and a(18) when (1,7), (7,1), and (5,5) are included.

Examples

			When radius of the circle exceeds 2^(1/2), one square is completely within the circle until the radius reaches 5^(1/2) when three squares are completely within the circle.
		

Crossrefs

First differences are in A229904.
The first differences must be odd at positions given in A024517 by proof by symmetry as r^2=2*n^2 is on the x=y line.
The radii corresponding to the terms are given by the square roots of A000404.
Cf. A237707 (3-dimensional analog), A239353 (4-dimensional analog).

Programs

  • Mathematica
    (* An empirical solution *) terms = 100; f[r_] := Sum[Floor[Sqrt[r^2 - n^2]], {n, 1, Floor[r]}]; Clear[g]; g[m_] := g[m] = Union[Table[f[Sqrt[s]], {s, 2, m }]][[1 ;; terms]]; g[m = dm = 4*terms]; g[m = m + dm]; While[g[m] != g[m - dm], Print[m]; m = m + dm]; A232499 = g[m]  (* Jean-François Alcover, Mar 06 2014 *)

A068785 Number of Cartesian lattice points in or on the circle x^2 + y^2 = 10^n.

Original entry on oeis.org

5, 37, 317, 3149, 31417, 314197, 3141549, 31416025, 314159053, 3141592409, 31415925457, 314159264013, 3141592649625, 31415926532017, 314159265350589, 3141592653588533, 31415926535867961, 314159265358987341, 3141592653589764829, 31415926535897744669
Offset: 0

Views

Author

Robert G. Wilson v, Mar 07 2002

Keywords

Comments

a(n) ~ Pi*10^n [Shanks, page 164]. "Gauss gave [a(2)] = 317 and [a(4)] = 31417." [Shanks, page 165].

References

  • Daniel Shanks, "Solved and Unsolved Problems in Number Theory," Fourth Edition, Chelsea Publishing Co., NY, 1993, pages 164-165 and 234 [gives a(n) for n = 8, 10, 12, 14].
  • Wolfram Research, Mathematica 4, Standard Add-On Packages, Wolfram Media, Inc., Champaign, Il, 1999, pages 322-3.

Crossrefs

Programs

  • Mathematica
    k = 1; s = 1; Do[s = s + SquaresR[2, n]; If[n == 10^k, k++; Print[s]], {n, 1, 10^6} ]

Formula

a(n) = Sum_{k=0..10^n} A004018(k). - Robert Israel, Jul 13 2014

Extensions

Definition and comments corrected by Jonathan Sondow, Dec 28 2012
a(0) corrected and a(9)-a(19) from Hiroaki Yamanouchi, Jul 13 2014

A057962 Number of points (x,y) in square lattice with (x-1/2)^2+(y-1/2)^2 <= n.

Original entry on oeis.org

4, 12, 16, 24, 32, 44, 52, 60, 68, 76, 80, 88, 96, 112, 120, 124, 140, 148, 156, 164, 172, 180, 188, 192, 208, 216, 232, 240, 248, 256, 268, 276, 284, 300, 308, 316, 332, 348, 360, 368, 376, 384, 392, 400, 408, 424, 432, 440, 448, 460, 468, 484, 492, 500
Offset: 1

Views

Author

Ken Takusagawa, Oct 15 2000

Keywords

Comments

Always a multiple of 4. Useful for rasterizing circles.

Examples

			a(2)=12 because (-1,0); (-1,1); (0,-1); (0,0); (0,1); (0,2); (1,-1); (1,0); (1,1); (1,2); (2,0); (2,1) are covered by any disc of radius between sqrt(2.5) and sqrt(4.5) and centered at (0.5,0.5).
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.

Crossrefs

Cf. A057961, A004018, A004020. Partial sums of A005883.

A237526 a(n) = number of unit squares in the first quadrant of a disk of radius sqrt(n) centered at the origin of a square lattice.

Original entry on oeis.org

0, 0, 1, 1, 1, 3, 3, 3, 4, 4, 6, 6, 6, 8, 8, 8, 8, 10, 11, 11, 13, 13, 13, 13, 13, 15, 17, 17, 17, 19, 19, 19, 20, 20, 22, 22, 22, 24, 24, 24, 26, 28, 28, 28, 28, 30, 30, 30, 30, 30, 33, 33, 35, 37, 37, 37, 37, 37, 39, 39, 39, 41, 41, 41, 41, 45, 45, 45, 47, 47
Offset: 0

Views

Author

L. Edson Jeffery, Feb 09 2014

Keywords

Crossrefs

Partial sums of A063725.

Programs

  • Mathematica
    a[n_]:=Sum[Floor[Sqrt[n-k^2]],{k,Floor[Sqrt[n]]}]; Array[a,70,0] (* Stefano Spezia, Jul 19 2024 *)
  • PARI
    A237526(n)=sum(k=1,sqrtint(n),sqrtint(n-k^2)) \\ M. F. Hasler, Feb 09 2014
    
  • Python
    from math import isqrt
    def A237526(n): return sum(isqrt(n-k**2) for k in range(1,isqrt(n)+1)) # Chai Wah Wu, Jul 18 2024

Formula

a(A000404(n)) = A232499(n).
a(n) = Sum_{k=1..floor(sqrt(n))} floor(sqrt(n-k^2)). - M. F. Hasler, Feb 09 2014
G.f.: (theta_3(x) - 1)^2/(4*(1 - x)), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 17 2018
For n > 1, Pi*(n+2-sqrt(8n)) < a(n) < Pi*n. (This is trivial and can probably be improved by methods like Euler-Maclaurin and perhaps even a modification of the Dirichlet hyperbola method.) - Charles R Greathouse IV, Jul 17 2024

A057656 Number of points (x,y) in square lattice with (x-1/2)^2+y^2 <= n.

Original entry on oeis.org

2, 6, 8, 12, 16, 16, 22, 26, 26, 30, 34, 38, 40, 44, 44, 48, 56, 56, 60, 60, 62, 70, 74, 74, 78, 82, 82, 86, 90, 94, 96, 104, 104, 104, 108, 108, 116, 120, 124, 128, 128, 128, 134, 138, 138, 142, 150, 150, 154, 158, 158, 166, 166, 166, 166, 174
Offset: 0

Views

Author

N. J. A. Sloane, Oct 15 2000

Keywords

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.

Crossrefs

Partial sums of A004020. Cf. A057656, A057961, A057962.

A105352 Numbers of points on successive rings of the simple square lattice.

Original entry on oeis.org

1, 4, 4, 4, 8, 4, 4, 8, 8, 4, 8, 4, 8, 12, 8, 8, 4, 8, 4, 8, 8, 8, 8, 4, 12, 8, 8, 8, 8, 4, 16, 8, 4, 8, 8, 8, 4, 8, 16, 8, 8, 8, 4, 12, 8, 8, 8, 8, 8, 8, 8, 4, 8, 16, 4, 16, 8, 8, 4, 16, 8, 8, 8, 8, 8, 8, 4, 8, 12, 16, 8, 8, 8, 8, 16, 8, 8, 4, 8, 12, 8, 16, 8, 8, 8, 16, 12, 8, 8, 8, 8, 8, 8, 4, 8, 8, 16, 4
Offset: 1

Views

Author

Sébastien Dumortier, Apr 30 2005

Keywords

Comments

This is A004018 with the zero terms omitted.
a(n) = A004018(A001481(n)). - Franz Vrabec, Jun 14 2005

Examples

			a(1) = 1 from (0, 0).
a(2) = 4 from (0, 1), (0, -1), (1, 0), (-1, 0).
a(5) = 8 from (+-1, +-2), (+-2, +-1).
		

Crossrefs

Cf. A004018, A001481; A057961 (partial sums).

Programs

Extensions

Definition revised by N. J. A. Sloane, Oct 04 2013
Showing 1-10 of 11 results. Next