login
Search: a057655 -id:a057655
     Sort: relevance | references | number | modified | created      Format: long | short | data
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).
(Formerly M3218)
+10
125
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,2
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
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 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).
E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, fourth edition, reprinted, 1958, Cambridge at the University Press.
LINKS
G. E. Andrews, R. Lewis and Z.-G. Liu, An identity relating a theta series to a sum of Lambert series, Bull. London Math. Soc., 33 (2001), 25-31.
H. H. Chan and C. Krattenthaler, Recent progress in the study of representations of integers as sums of squares, arXiv:math/0407061 [math.NT], 2004.
S. Cooper and M. Hirschhorn, A combinatorial proof of a result from number theory, Integers 4 (2004), #A09.
J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math. 38 (1907), 1-62. (This sequence is called rho, see page 6)
M. D. Hirschhorn, The number of representations of a number by various forms, Discrete Mathematics 298 (2005), 205-211.
Jacobi-Legendre letters, Correspondance mathématique entre Legendre et Jacobi, J. Reine Angew. Math. 80 (1875) 205-279, letter of September 9, 1828, p. 240-243, formula for 2K/Pi on p. 242.
Christian Kassel and Christophe Reutenauer, The zeta function of the Hilbert scheme of n points on a two-dimensional torus, arXiv:1505.07229v3 [math.AG], 2015. [Note that a later version of this paper has a different title and different contents, and the number-theoretical part of the paper was moved to the publication which is next in this list.]
Christian Kassel and Christophe Reutenauer, Complete determination of the zeta function of the Hilbert scheme of n points on a two-dimensional torus, arXiv:1610.07793 [math.NT], 2016.
Christian Kassel, Christophe Reutenauer, The Fourier expansion of eta(z)eta(2z)eta(3z)/eta(6z), arXiv:1603.06357 [math.NT], 2016.
M. Kontsevich and D. Zagier, Periods, Institut des Hautes Etudes Scientifiques 2001 IHES/M/01/22. Published in B. Engquist and W. Schmid, editors, Mathematics Unlimited - 2001 and Beyond, 2 vols., Springer-Verlag, 2001, pp. 771-808, section 2.3. Example 3.
Y. Martin, Multiplicative eta-quotients, Trans. Amer. Math. Soc. 348 (1996), no. 12, 4825-4856, see page 4852 Table I.
G. Nebe and N. J. A. Sloane, Home page for this lattice
Grant Sanderson, Pi hiding in prime regularities, 3Blue1Brown video (2017).
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
G. Villemin, Sommes de 2 carrés
Eric Weisstein's World of Mathematics, Barnes-Wall Lattice
Eric Weisstein's World of Mathematics, Moebius Transform
Eric Weisstein's World of Mathematics, Ramanujan Theta Functions
Eric Weisstein's World of Mathematics, Sum of Squares Function
Eric Weisstein's World of Mathematics, Theta Series
Zach Wissner-Gross a.k.a. The Riddler, Riddler Express: Can You Climb Your Way To Victory?, FiveThirtyEight, Sep 24 2021.
G. Xiao, Two squares
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.
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
EXAMPLE
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
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 *)
PROG
(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
(Magma) Basis( ModularForms( Gamma1(4), 1), 100) [1]; /* Michael Somos, Jun 10 2014 */
(Sage)
Q = DiagonalQuadraticForm(ZZ, [1]*2)
Q.representation_number_list(102) # Peter Luschny, Jun 20 2014
(Julia) # JacobiTheta3 is defined in A000122.
A004018List(len) = JacobiTheta3(len, 2)
A004018List(102) |> println # Peter Luschny, Mar 12 2018
(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.
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.
KEYWORD
nonn,easy,nice,core
STATUS
approved
9-gonal (or enneagonal or nonagonal) numbers: a(n) = n*(7*n-5)/2.
(Formerly M4604)
+10
87
0, 1, 9, 24, 46, 75, 111, 154, 204, 261, 325, 396, 474, 559, 651, 750, 856, 969, 1089, 1216, 1350, 1491, 1639, 1794, 1956, 2125, 2301, 2484, 2674, 2871, 3075, 3286, 3504, 3729, 3961, 4200, 4446, 4699, 4959, 5226, 5500, 5781, 6069, 6364
OFFSET
0,3
COMMENTS
Sequence found by reading the line from 0, in the direction 0, 9, ... and the parallel line from 1, in the direction 1, 24, ..., in the square spiral whose vertices are the generalized 9-gonal (enneagonal) numbers A118277. Also sequence found by reading the same lines in the square spiral whose edges have length A195019 and whose vertices are the numbers A195020. - Omar E. Pol, Sep 10 2011
Number of ordered pairs of integers (x,y) with abs(x) < n, abs(y) < n and x+y <= n. - Reinhard Zumkeller, Jan 23 2012
Partial sums give A007584. - Omar E. Pol, Jan 15 2013
REFERENCES
Albert H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 189.
E. Deza and M. M. Deza, Figurate numbers, World Scientific Publishing (2012), page 6.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe and William A. Tedeschi, Table of n, a(n) for n = 0..10000 (1000 terms were computed by T. D. Noe)
S. Barbero, U. Cerruti and N. Murru, Transforming Recurrent Sequences by Using the Binomial and Invert Operators, J. Int. Seq. 13 (2010) # 10.7.7, section 4.4.
C. K. Cook and M. R. Bacon, Some polygonal number summation formulas, Fib. Q., 52 (2014), 336-343.
Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992
Eric Weisstein's World of Mathematics, Nonagonal Number.
FORMULA
a(n) = (7*n - 5)*n/2.
G.f.: x*(1+6*x)/(1-x)^3. - Simon Plouffe in his 1992 dissertation.
a(n) = n + 7*A000217(n-1). - Floor van Lamoen, Oct 14 2005
Starting (1, 9, 24, 46, 75, ...) gives the binomial transform of (1, 8, 7, 0, 0, 0, ...). - Gary W. Adamson, Jul 22 2007
Row sums of triangle A131875 starting (1, 9, 24, 46, 75, 111, ...). A001106 = binomial transform of (1, 8, 7, 0, 0, 0, ...). - Gary W. Adamson, Jul 22 2007
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3), a(0) = 0, a(1) = 1, a(2) = 9. - Jaume Oliver Lafont, Dec 02 2008
a(n) = 2*a(n-1) - a(n-2) + 7. - Mohamed Bouhamida, May 05 2010
a(n) = a(n-1) + 7*n - 6 (with a(0) = 0). - Vincenzo Librandi, Nov 12 2010
a(n) = A174738(7n). - Philippe Deléham, Mar 26 2013
a(7*a(n) + 22*n + 1) = a(7*a(n) + 22*n) + a(7*n+1). - Vladimir Shevelev, Jan 24 2014
E.g.f.: x*(2 + 7*x)*exp(x)/2. - Ilya Gutkovskiy, Jul 28 2016
a(n+2) + A000217(n) = (2*n+3)^2. - Ezhilarasu Velayutham, Mar 18 2020
Product_{n>=2} (1 - 1/a(n)) = 7/9. - Amiram Eldar, Jan 21 2021
Sum_{n>=1} 1/a(n) = A244646. - Amiram Eldar, Nov 12 2021
a(n) = A000217(3*n-2) - (n-1)^2. - Charlie Marion, Feb 27 2022
a(n) = 3*A000217(n) + 2*A005563(n-2). In general, if P(k,n) = the n-th k-gonal number, then P(m*k,n) = m*P(k,n) + (m-1)*A005563(n-2). - Charlie Marion, Feb 21 2023
MATHEMATICA
Table[n(7n - 5)/2, {n, 0, 50}] (* or *) LinearRecurrence[{3, -3, 1}, {0, 1, 9}, 50] (* Harvey P. Dale, Nov 06 2011 *)
(* For Mathematica 10.4+ *) Table[PolygonalNumber[RegularPolygon[9], n], {n, 0, 43}] (* Arkadiusz Wesolowski, Aug 27 2016 *)
PolygonalNumber[9, Range[0, 50]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 19 2019 *)
PROG
(PARI) a(n)=n*(7*n-5)/2 \\ Charles R Greathouse IV, Jun 10 2011
(Haskell)
a001106 n = length [(x, y) | x <- [-n+1..n-1], y <- [-n+1..n-1], x + y <= n]
-- Reinhard Zumkeller, Jan 23 2012
(Haskell) a001106 n = n*(7*n-5) `div` 2 -- James Spahlinger, Oct 18 2012
(Python)
def aList(): # Intended to compute the initial segment of the sequence, not isolated terms.
x, y = 1, 1
yield 0
while True:
yield x
x, y = x + y + 7, y + 7
A001106 = aList()
print([next(A001106) for i in range(49)]) # Peter Luschny, Aug 04 2019
CROSSREFS
Cf. A093564 ((7, 1) Pascal, column m=2). Partial sums of A016993.
KEYWORD
nonn,easy,nice
STATUS
approved
Centered heptagonal numbers.
+10
63
1, 8, 22, 43, 71, 106, 148, 197, 253, 316, 386, 463, 547, 638, 736, 841, 953, 1072, 1198, 1331, 1471, 1618, 1772, 1933, 2101, 2276, 2458, 2647, 2843, 3046, 3256, 3473, 3697, 3928, 4166, 4411, 4663, 4922, 5188, 5461, 5741, 6028, 6322, 6623, 6931, 7246
OFFSET
1,2
COMMENTS
Equals the triangular numbers convolved with [ 1, 5, 1, 0, 0, 0, ...]. - Gary W. Adamson and Alexander R. Povolotsky, May 29 2009
Number of ordered pairs of integers (x,y) with abs(x) < n, abs(y) < n and abs(x + y) < n, counting twice pairs of equal numbers. - Reinhard Zumkeller, Jan 23 2012; corrected and extended by Mauro Fiorentini, Jan 01 2018
The number of pairs without repetitions is a(n) - 2n + 3 for n > 1. For example, there are 19 such pairs for n = 3: (-2, 0), (-2, 1), (-2, 2), (-1, -1), (-1, 0), (-1, 1), (-1, 2), (0, -2), (0, -1), (0, 0), (0, 1), (0, 2), (1, -2), (1, -1), (1, 0), (1, 1), (2, -2), (2, -1), (2, 0). - Mauro Fiorentini, Jan 01 2018
FORMULA
a(n) = (7*n^2 - 7*n + 2)/2.
a(n) = 1 + Sum_{k=1..n} 7*k. - Xavier Acloque, Oct 26 2003
Binomial transform of [1, 7, 7, 0, 0, 0, ...]; Narayana transform (A001263) of [1, 7, 0, 0, 0, ...]. - Gary W. Adamson, Dec 29 2007
a(n) = 7*n + a(n-1) - 7 (with a(1)=1). - Vincenzo Librandi, Aug 08 2010
G.f.: x*(1+5*x+x^2) / (1-x)^3. - R. J. Mathar, Feb 04 2011
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3); a(0)=1, a(1)=8, a(2)=22. - Harvey P. Dale, Jun 04 2011
a(n) = A024966(n-1) + 1. - Omar E. Pol, Oct 03 2011
a(n) = 2*a(n-1) - a(n-2) + 7. - Ant King, Jun 17 2012
From Ant King, Jun 17 2012: (Start)
Sum_{n>=1} 1/a(n) = 2*Pi/sqrt(7)*tanh(Pi/(2*sqrt(7))) = 1.264723171685652...
a(n) == 1 (mod 7) for all n.
The sequence of digital roots of the a(n) is period 9: repeat [1, 8, 4, 7, 8, 7, 4, 8, 1] (the period is a palindrome).
The sequence of a(n) mod 10 is period 20: repeat [1, 8, 2, 3, 1, 6, 8, 7, 3, 6, 6, 3, 7, 8, 6, 1, 3, 2, 8, 1] (the period is a palindrome).
(End)
E.g.f.: -1 + (2 + 7*x^2)*exp(x)/2. - Ilya Gutkovskiy, Jun 30 2016
a(n) = A101321(7,n-1). - R. J. Mathar, Jul 28 2016
From Amiram Eldar, Jun 20 2020: (Start)
Sum_{n>=1} a(n)/n! = 9*e/2 - 1.
Sum_{n>=1} (-1)^n * a(n)/n! = 9/(2*e) - 1. (End)
a(n) = A003215(n-1) + A000217(n-1). - Leo Tavares, Jul 19 2022
EXAMPLE
a(5) = 71 because 71 = (7*5^2 - 7*5 + 2)/2 = (175 - 35 + 2)/2 = 142/2.
From Bruno Berselli, Oct 27 2017: (Start)
1 = -(0) + (1).
8 = -(0+1) + (2+3+4).
22 = -(0+1+2) + (3+4+5+6+7).
43 = -(0+1+2+3) + (4+5+6+7+8+9+10).
71 = -(0+1+2+3+4) + (5+6+7+8+9+10+11+12+13). (End)
MATHEMATICA
FoldList[#1 + #2 &, 1, 7 Range@ 50] (* Robert G. Wilson v, Feb 02 2011 *)
LinearRecurrence[{3, -3, 1}, {1, 8, 22}, 50] (* Harvey P. Dale, Jun 04 2011 *)
PROG
(Haskell)
a069099 n = length
[(x, y) | x <- [-n+1..n-1], y <- [-n+1..n-1], x + y <= n - 1]
-- Reinhard Zumkeller, Jan 23 2012
(PARI) a(n)=(7*n^2-7*n+2)/2 \\ Charles R Greathouse IV, Sep 24 2015
CROSSREFS
Cf. A000566 (heptagonal numbers).
KEYWORD
nonn,easy,nice
AUTHOR
Terrel Trotter, Jr., Apr 05 2002
STATUS
approved
Number of points of norm <= n^2 in square lattice.
(Formerly M3829 N1570)
+10
44
1, 5, 13, 29, 49, 81, 113, 149, 197, 253, 317, 377, 441, 529, 613, 709, 797, 901, 1009, 1129, 1257, 1373, 1517, 1653, 1793, 1961, 2121, 2289, 2453, 2629, 2821, 3001, 3209, 3409, 3625, 3853, 4053, 4293, 4513, 4777, 5025, 5261, 5525, 5789, 6077, 6361, 6625
OFFSET
0,2
COMMENTS
Number of ordered pairs of integers (x,y) with x^2 + y^2 <= n^2.
REFERENCES
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
H. Gupta, A Table of Values of N_3(t), Proc. National Institute of Sciences of India, 13 (1947), 35-63.
C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 47.
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 and Robert Israel, Table of n, a(n) for n = 0..10000 (n=0..1000 from T. D. Noe)
W. Fraser and C. C. Gotlieb, A calculation of the number of lattice points in the circle and sphere, Math. Comp., 16 (1962), 282-290.
Eric Weisstein's World of Mathematics, Gauss's Circle Problem
FORMULA
a(n) = 1 + 4 * Sum_{j>=0} floor(n^2/(4*j+1)) - floor(n^2/(4*j+3)). Also a(n) = A057655(n^2). - Max Alekseyev, Nov 18 2007
a(n) = 4*A000603(n) - (4*n+3), n >= 0. - Wolfdieter Lang, Mar 15 2015
a(n) = 1+4*n^2-4*ceiling((n-1)/sqrt(2))-8*A247588(n-1), n>1. - Mats Granvik, May 23 2015
a(n) = [x^(n^2)] theta_3(x)^2/(1 - x), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 14 2018
lim_{n->oo} a(n)/n^2 = Pi. - Chai Wah Wu, Feb 12 2025
MATHEMATICA
Table[Sum[SquaresR[2, k], {k, 0, n^2}], {n, 0, 46}]
PROG
(PARI) { a(n) = 1 + 4 * sum(j=0, n^2\4, n^2\(4*j+1) - n^2\(4*j+3) ) } /* Max Alekseyev, Nov 18 2007 */
(Haskell)
a000328 n = length [(x, y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 <= n^2]
-- Reinhard Zumkeller, Jan 23 2012
(Python)
def A000328(n):
return (sum([int((n**2 - y**2)**0.5) for y in range(1, n)]) * 4 + 4*n + 1)
# Karl-Heinz Hofmann, Aug 03 2022
(Python)
from math import isqrt
def A000328(n): return 1+(sum(isqrt(k*((n<<1)-k)) for k in range(1, n+1))<<2) # Chai Wah Wu, Feb 12 2025
CROSSREFS
Column k=2 of A302997.
Equals A051132 + A046109. For another version see A057655.
KEYWORD
nonn,easy,nice
EXTENSIONS
More terms from David W. Wilson, May 22 2000
Edited at the suggestion of Max Alekseyev by N. J. A. Sloane, Nov 18 2007
Incorrect comment removed by Eric M. Schmidt, May 28 2015
STATUS
approved
Number of lattice points inside the ball x^2 + y^2 + z^2 <= n.
+10
23
1, 7, 19, 27, 33, 57, 81, 81, 93, 123, 147, 171, 179, 203, 251, 251, 257, 305, 341, 365, 389, 437, 461, 461, 485, 515, 587, 619, 619, 691, 739, 739, 751, 799, 847, 895, 925, 949, 1021, 1021, 1045, 1141, 1189, 1213, 1237, 1309, 1357, 1357, 1365, 1419, 1503
OFFSET
0,2
LINKS
S. K. K. Choi, A. V. Kumchev and R. Osburn, On sums of three squares, arXiv:math/0502007 [math.NT], 2005.
FORMULA
a(n) ~ (4/3)*Pi*n^(3/2) ~ A210639(n).
a(n) = A122510(3,n). - R. J. Mathar, Apr 21 2010
G.f.: T3(q)^3/(1-q) where T3(q) = 1 + 2*Sum_{k>=1} q^(k^2). - Joerg Arndt, Apr 08 2013
EXAMPLE
a(2) = 1 + 6 + 12 = 19, since (0,0,0) and (0, 0, +-1) and cyclic permutations (for a total of 6 points), and +-(0, 1, +-1) and cyclic permutations (for a total 12 points) are inside or on x^2 + y^2 + z^2 = 2.
MATHEMATICA
Table[Sum[SquaresR[3, k], {k, 0, n}], {n, 0, 50}] (* T. D. Noe, Apr 08 2006, revised Sep 27 2011 *)
PROG
(PARI) A117609(n)=sum(x=0, sqrtint(n), (sum(y=1, sqrtint(t=n-x^2), 1+2*sqrtint(t-y^2))*2+sqrtint(t)*2+1)*2^(x>0)) \\ M. F. Hasler, Mar 26 2012
(PARI) q='q+O('q^66); Vec((eta(q^2)^5/(eta(q)^2*eta(q^4)^2))^3/(1-q)) /* Joerg Arndt, Apr 08 2013 */
(Python)
# uses Python code for A057655
from math import isqrt
def A117609(n): return A057655(n)+(sum(A057655(n-k**2) for k in range(1, isqrt(n)+1))<<1) # Chai Wah Wu, Jun 23 2024
CROSSREFS
Partial sums of A005875.
Cf. A000605 (number of points of norm <= n in cubic lattice).
Cf. A210639, A000092 and references therein.
Cf. A057655.
KEYWORD
nonn
AUTHOR
John L. Drost, Apr 06 2006
STATUS
approved
Array T(d,n) = number of integer lattice points inside the d-dimensional hypersphere of radius sqrt(n), read by ascending antidiagonals.
+10
19
1, 1, 3, 1, 5, 3, 1, 7, 9, 3, 1, 9, 19, 9, 5, 1, 11, 33, 27, 13, 5, 1, 13, 51, 65, 33, 21, 5, 1, 15, 73, 131, 89, 57, 21, 5, 1, 17, 99, 233, 221, 137, 81, 21, 5, 1, 19, 129, 379, 485, 333, 233, 81, 25, 7, 1, 21, 163, 577, 953, 797, 573, 297, 93, 29, 7, 1, 23, 201, 835, 1713, 1793
OFFSET
1,3
COMMENTS
Number of solutions to sum_(i=1,..,d) x[i]^2 <= n, x[i] in Z. T(1,n)=A001650(n+1); T(2,n)=A057655(n); T(3,n)=A117609(n); T(4,n)=A046895(n); T(d,1)=A005408(d); T(d,2)=A058331(d).
FORMULA
Recurrence along rows: T(d,n)=T(d,n-1)+A122141(d,n) for n>=1; T(d,n)=sum_{i=0..n} A122141(d,i). Recurrence along columns: cf. A123937.
EXAMPLE
T(2,2)=9 counts 1 pair (0,0) with sum 0, 4 pairs (-1,0),(1,0),(0,-1),(0,1) with sum 1 and 4 pairs (-1,-1),(-1,1),(1,1),(1,-1) with sum 2.
Array T(d,n) with rows d=1,2,3... and columns n=0,1,2,3.. reads
1 3 3 3 5 5 5 5 5 7 7
1 5 9 9 13 21 21 21 25 29 37
1 7 19 27 33 57 81 81 93 123 147
1 9 33 65 89 137 233 297 321 425 569
1 11 51 131 221 333 573 893 1093 1343 1903
1 13 73 233 485 797 1341 2301 3321 4197 5757
1 15 99 379 953 1793 3081 5449 8893 12435 16859
1 17 129 577 1713 3729 6865 12369 21697 33809 47921
1 19 163 835 2869 7189 14581 27253 49861 84663 129303
1 21 201 1161 4541 12965 29285 58085 110105 198765 327829
MAPLE
T := proc(d, n) local i, cnts ; cnts := 0 ; for i from -trunc(sqrt(n)) to trunc(sqrt(n)) do if n-i^2 >= 0 then if d > 1 then cnts := cnts+T(d-1, n-i^2) ; else cnts := cnts+1 ; fi ; fi ; od ; RETURN(cnts) ; end: for diag from 1 to 14 do for n from 0 to diag-1 do d := diag-n ; printf("%d, ", T(d, n)) ; od ; od;
MATHEMATICA
t[d_, n_] := t[d, n] = t[d, n-1] + SquaresR[d, n]; t[d_, 0] = 1; Table[t[d-n, n], {d, 1, 12}, {n, 0, d-1}] // Flatten (* Jean-François Alcover, Jun 13 2013 *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
R. J. Mathar, Oct 29 2006, Oct 31 2006
STATUS
approved
Number of points in square lattice covered by a disc centered at (0,0) as its radius increases.
+10
12
1, 5, 9, 13, 21, 25, 29, 37, 45, 49, 57, 61, 69, 81, 89, 97, 101, 109, 113, 121, 129, 137, 145, 149, 161, 169, 177, 185, 193, 197, 213, 221, 225, 233, 241, 249, 253, 261, 277, 285, 293, 301, 305, 317, 325, 333, 341, 349, 357, 365, 373, 377, 385, 401, 405, 421
OFFSET
1,2
COMMENTS
Useful for rasterizing circles.
Conjecture: the number of lattice points in a quadrant of the disk is equal to A000592(n-1). - L. Edson Jeffery, Feb 10 2014
REFERENCES
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
EXAMPLE
a(2)=5 because (0,0); (0,1); (0,-1); (1,0); (-1,0) are covered by any disc of radius between 1 and sqrt(2).
MATHEMATICA
max = 100; A001481 = Select[Range[0, 4*max], SquaresR[2, #] != 0 &]; Table[SquaresR[2, A001481[[n]]], {n, 1, max}] // Accumulate (* Jean-François Alcover, Oct 04 2013 *)
CROSSREFS
Cf. A004018, A004020, A005883, A057962. Distinct terms of A057655.
KEYWORD
easy,nonn
AUTHOR
Ken Takusagawa, Oct 15 2000
STATUS
approved
Number of Cartesian lattice points in or on the circle x^2 + y^2 = 10^n.
+10
11
5, 37, 317, 3149, 31417, 314197, 3141549, 31416025, 314159053, 3141592409, 31415925457, 314159264013, 3141592649625, 31415926532017, 314159265350589, 3141592653588533, 31415926535867961, 314159265358987341, 3141592653589764829, 31415926535897744669
OFFSET
0,1
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.
FORMULA
a(n) = Sum_{k=0..10^n} A004018(k). - Robert Israel, Jul 13 2014
MATHEMATICA
k = 1; s = 1; Do[s = s + SquaresR[2, n]; If[n == 10^k, k++; Print[s]], {n, 1, 10^6} ]
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Mar 07 2002
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
STATUS
approved
Number of nonnegative solutions to x^2 + y^2 <= n.
+10
11
1, 3, 4, 4, 6, 8, 8, 8, 9, 11, 13, 13, 13, 15, 15, 15, 17, 19, 20, 20, 22, 22, 22, 22, 22, 26, 28, 28, 28, 30, 30, 30, 31, 31, 33, 33, 35, 37, 37, 37, 39, 41, 41, 41, 41, 43, 43, 43, 43, 45, 48, 48, 50, 52, 52, 52, 52, 52, 54, 54, 54, 56, 56, 56, 58, 62, 62, 62, 64
OFFSET
0,2
LINKS
FORMULA
G.f.: (1/(1 - x))*(Sum_{k>=0} x^(k^2))^2. - Ilya Gutkovskiy, Mar 14 2017
MATHEMATICA
nn = 68; t = Table[0, {nn}]; Do[d = x^2 + y^2; If[0 < d <= nn, t[[d]]++], {x, 0, nn}, {y, 0, nn}]; Accumulate[Join[{1}, t]] (* T. D. Noe, Apr 01 2013 *)
PROG
(Python)
for n in range(99):
k = 0
for x in range(99):
s = x*x
if s>n: break
for y in range(99):
sy = s + y*y
if sy>n: break
k+=1
print(str(k), end=', ')
CROSSREFS
Cf. A000925 (first differences).
Cf. A000606 (number of nonnegative solutions to x^2 + y^2 + z^2 <= n).
Cf. A057655 (number of integer solutions to x^2 + y^2 <= n).
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Apr 01 2013
STATUS
approved
Let A(n) = #{(i,j): i^2 + j^2 <= n}, V(n) = Pi*n, P(n) = A(n) - V(n); A000099 gives values of n where |P(n)| sets a new record; sequence gives closest integer to P(A000099(n)).
(Formerly M0610 N0221)
+10
7
2, 3, 5, 6, 6, -6, 7, 8, 10, 13, 13, 13, 14, -17, 17, 17, 18, -19, 20, -22, 23, 27, -29, -29, 29, -31, -32, -35, 36, -37, -40, -43, -46, -48, -50, -53, -55, -57, -60, -60, -61, -63, -66, -66, -68, -71, -74, -77, -79, -82, -85, -88, -89, -92, -95, -96, -97, -97, -100
OFFSET
1,1
REFERENCES
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
W. C. Mitchell, The number of lattice points in a k-dimensional hypersphere, Math. Comp., 20 (1966), 300-310.
FORMULA
a(n) = round(P(A000099(n))), where P(n) = A057655(n)-pi*n. - David W. Wilson, May 15 2008
MATHEMATICA
nmax = 6*10^4; A[n_] := 1 + 4*Floor[Sqrt[n]] + 4*Floor[Sqrt[n/2]]^2 + 8* Sum[Floor[Sqrt[n - j^2]], {j, Floor[Sqrt[n/2]] + 1, Floor[Sqrt[n]]}]; V[n_] := Pi*n; P[n_] := A[n] - V[n]; record = 0; A000036 = Reap[For[k = 0; n = 1, n <= nmax, n++, p = Abs[pn = P[n]]; If[p > record, record = p; k++; Sow[pn // Round]; Print["a(", k, ") = ", pn // Round]]]][[2, 1]] (* Jean-François Alcover, Feb 03 2016 *)
CROSSREFS
KEYWORD
sign
EXTENSIONS
Revised by N. J. A. Sloane, Jun 26 2005
More terms from David W. Wilson, May 15 2008
STATUS
approved

Search completed in 0.021 seconds