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.

A008441 Number of ways of writing n as the sum of 2 triangular numbers.

This page as a plain text file.
%I A008441 #193 Jul 18 2025 05:41:23
%S A008441 1,2,1,2,2,0,3,2,0,2,2,2,1,2,0,2,4,0,2,0,1,4,2,0,2,2,0,2,2,2,1,4,0,0,
%T A008441 2,0,4,2,2,2,0,0,3,2,0,2,4,0,2,2,0,4,0,0,0,4,3,2,2,0,2,2,0,0,2,2,4,2,
%U A008441 0,2,2,0,3,2,0,0,4,0,2,2,0,6,0,2,2,0,0,2,2,0,1,4,2,2,4,0,0,2,0,2,2,2,2,0,0
%N A008441 Number of ways of writing n as the sum of 2 triangular numbers.
%C A008441 Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700). The present sequence gives the expansion coefficients of psi(q)^2.
%C A008441 Also the number of positive odd solutions to equation x^2 + y^2 = 8*n + 2. - _Seiichi Manyama_, May 28 2017
%D A008441 B. C. Berndt, Ramanujan's Notebooks Part III, Springer-Verlag. See p. 139 Example (iv).
%D A008441 J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
%D A008441 R. W. Gosper, Strip Mining in the Abandoned Orefields of Nineteenth Century Mathematics, in Computers in Mathematics (Ed. D. V. Chudnovsky and R. D. Jenks). New York: Dekker, 1990. See p. 279.
%D A008441 R. W. Gosper, Experiments and discoveries in q-trigonometry, in Symbolic Computation, Number Theory, Special Functions, Physics and Combinatorics. Editors: F. G. Garvan and M. E. H. Ismail. Kluwer, Dordrecht, Netherlands, 2001, pp. 79-105. [See Pi_q.]
%D A008441 P. A. MacMahon, Combinatory Analysis, Cambridge Univ. Press, London and New York, Vol. 1, 1915 and Vol. 2, 1916. See vol. 2, p 31, Article 272.
%D A008441 Ivan Niven, Herbert S. Zuckerman and Hugh L. Montgomery, An Introduction to the Theory Of Numbers, Fifth Edition, John Wiley and Sons, Inc., NY 1991, p. 165.
%H A008441 T. D. Noe, <a href="/A008441/b008441.txt">Table of n, a(n) for n = 0..10000</a>
%H A008441 M. Abramowitz and I. A. Stegun, eds., <a href="http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP">Handbook of Mathematical Functions</a>, National Bureau of Standards Applied Math. Series 55, Tenth Printing, 1972, p. 575, 16.23.1 and 16.23.2.
%H A008441 R. P. Agarwal, <a href="https://www.ias.ac.in/article/fulltext/pmsc/103/03/0269-0293">Lambert series and Ramanujan</a>, Prod. Indian Acad. Sci. (Math. Sci.), v. 103, n. 3, 1993, pp. 269-293 (see p. 285).
%H A008441 N. J. Fine, <a href="http://bookstore.ams.org/surv-27/">Basic Hypergeometric Series and Applications</a>, Amer. Math. Soc., 1988; p. 72, Eq (31.2); p. 78, Eq. following (32.25).
%H A008441 J. W. L. Glaisher, <a href="http://gdz.sub.uni-goettingen.de/en/dms/loader/img/?PID=PPN600494829_0020%7CLOG_0017">On the function chi(n)</a>, Quarterly Journal of Pure and Applied Mathematics, 20 (1884), 97-167. See p. 108.
%H A008441 R. W. Gosper, <a href="/A274621/a274621.pdf">Experiments and discoveries in q-trigonometry</a>, Preprint.
%H A008441 R. W. Gosper, <a href="/A274621/a274621_1.pdf">q-Trigonometry: Some Prefatory Afterthoughts</a>.
%H A008441 Michael D. Hirschhorn, <a href="http://dx.doi.org/10.1016/j.disc.2004.08.045">The number of representations of a number by various forms</a>, Discrete Mathematics 298 (2005), 205-211.
%H A008441 Nadia Heninger, E. M. Rains and N. J. A. Sloane, <a href="https://arxiv.org/abs/math/0509316">On the Integrality of n-th Roots of Generating Functions</a>, arXiv:math/0509316 [math.NT], 2005-2006; J. Combinatorial Theory, Series A, 113 (2006), 1732-1745.
%H A008441 Nicco, <a href="https://math.stackexchange.com/questions/1428124/">Conjectured identity of the product of two theta functions</a>, Math Stackexchange, Sep 09 2015.
%H A008441 K. Ono, S. Robins and P. T. Wahl, <a href="http://www.mathcs.emory.edu/~ono/publications-cv/pdfs/006.pdf">On the representation of integers as sums of triangular numbers</a>, Aequationes mathematicae, August 1995, Volume 50, Issue 1-2, pp. 73-94.
%H A008441 Hjalmar Rosengren, <a href="https://arxiv.org/abs/math/0504272">Sums of triangular numbers from the Frobenius determinant</a>, arXiv:math/0504272 [math.NT], 2005.
%H A008441 James A. Sellers and Roberto Tauraso, <a href="https://arxiv.org/abs/2505.12813">Arithmetic properties of MacMahon-type sums of divisors: the odd case</a>, arXiv:2505.12813 [math.NT], 2025.
%H A008441 Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>.
%H A008441 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>.
%F A008441 This sequence is the quadrisection of many sequences. Here are two examples:
%F A008441 a(n) = A002654(4n+1), the difference between the number of divisors of 4*n+1 of form 4*k+1 and the number of form 4*k-1. - _David Broadhurst_, Oct 20 2002
%F A008441 a(n) = b(4*n + 1), where b(n) is multiplicative and b(2^e) = 0^e, b(p^e) = (1 + (-1)^e) / 2 if p == 3 (mod 4), b(p^e) = e+1 if p == 1 (mod 4). - _Michael Somos_, Sep 14 2005
%F A008441 G.f.: (Sum_{k>=0} x^((k^2 + k)/2))^2 = (Sum_{k>=0} x^(k^2 + k)) * (Sum_{k in Z} x^(k^2)).
%F A008441 Expansion of Jacobi theta (theta_2(0, sqrt(q)))^2 / (4 * q^(1/4)).
%F A008441 Sum[d|(4n+1), (-1)^((d-1)/2) ].
%F A008441 Given g.f. A(x), then B(q) = q * A(q^4) satisfies 0 = f(B(q), B(q^2), B(q^4)) where f(u, v, w) = v^3 + 4 * v * w^2 - u^2 * w. - _Michael Somos_, Sep 14 2005
%F A008441 Given g.f. A(x), then B(q) = q * A(q^4) satisfies 0 = f(B(q), B(q^2), B(q^3), B(q^6)) where f(u1, u2, u3, u6) = u1 * u3 - (u2 - u6) * (u2 + 3*u6). - _Michael Somos_, Sep 14 2005
%F A008441 Expansion of Jacobi k/(4*q^(1/2)) * (2/Pi)* K(k) in powers of q^2. - _Michael Somos_, Sep 14 2005. Convolution of A001938 and A004018. This appears in the denominator of the Jacobi sn and cn formula given in the Abramowitz-Stegun reference, p. 575, 16.23.1 and 16.23.2, where m=k^2. - _Wolfdieter Lang_, Jul 05 2016
%F A008441 G.f.: Sum_{k>=0} a(k) * x^(2*k) = Sum_{k>=0} x^k / (1 + x^(2*k + 1)).
%F A008441 G.f.: Sum_{k in Z} x^k / (1 - x^(4*k + 1)). - _Michael Somos_, Nov 03 2005
%F A008441 Expansion of psi(x)^2 = phi(x) * psi(x^2) in powers of x where phi(), psi() are Ramanujan theta functions.
%F A008441 Moebius transform is period 8 sequence [ 1, -1, -1, 0, 1, 1, -1, 0, ...]. - _Michael Somos_, Jan 25 2008
%F A008441 G.f. is a period 1 Fourier series which satisfies f(-1 / (8 t)) = 1/2 (t/i) g(t) where q = exp(2 Pi i t) and g() is the g.f. for A104794.
%F A008441 Euler transform of period 2 sequence [ 2, -2, ...].
%F A008441 G.f.: q^(-1/4) * eta(q^2)^4 / eta(q)^2. See also the Fine reference.
%F A008441 a(n) = Sum_{k=0..n} A010054(k)*A010054(n-k). - _Reinhard Zumkeller_, Nov 03 2009
%F A008441 A004020(n) = 2 * a(n). A005883(n) = 4 * a(n).
%F A008441 Convolution square of A010054.
%F A008441 G.f.: Product_{k>0} (1 - x^(2*k))^2 / (1 - x^(2*k-1))^2.
%F A008441 a(2*n) = A113407(n). a(2*n + 1) = A053692(n). a(3*n) = A002175(n). a(3*n + 1) = 2 * A121444(n). a(9*n + 2) = a(n). a(9*n + 5) = a(9*n + 8) = 0. - _Michael Somos_, Jun 08 2014
%F A008441 G.f.: exp( Sum_{n>=1} 2*(x^n/n) / (1 + x^n) ). - _Paul D. Hanna_, Mar 01 2016
%F A008441 a(n) = A001826(2+8*n) - A001842(2+8*n), the difference between the number of divisors 1 (mod 4) and 3 (mod 4) of 2+8*n. See the Ono et al. link, Corollary 1, or directly the Niven et al. reference, p. 165, Corollary (3.23). - _Wolfdieter Lang_, Jan 11 2017
%F A008441 Expansion of continued fraction 1 / (1 - x^1 + x^1*(1 - x^1)^2 / (1 - x^3 + x^2*(1 - x^2)^2 / (1 - x^5 + x^3*(1 - x^3)^2 / ...))) in powers of x^2. - _Michael Somos_, Apr 20 2017
%F A008441 Given g.f. A(x), and B(x) is the g.f. for A079006, then B(x) = A(x^2) / A(x) and B(x) * B(x^2) * B(x^4) * ... = 1 / A(x). - _Michael Somos_, Apr 20 2017
%F A008441 a(0) = 1, a(n) = (2/n)*Sum_{k=1..n} A002129(k)*a(n-k) for n > 0. - _Seiichi Manyama_, May 06 2017
%F A008441 From _Paul D. Hanna_, Aug 10 2019: (Start)
%F A008441 G.f.: Sum_{n>=0} x^n * Sum_{k=0..n} binomial(n,k) * (x^(2*n+1) - x^(2*k))^(n-k) = Sum_{n>=0} a(n)*x^(2*n).
%F A008441 G.f.: Sum_{n>=0} x^n * Sum_{k=0..n} binomial(n,k) * (x^(2*n+1) + x^(2*k))^(n-k) * (-1)^k = Sum_{n>=0} a(n)*x^(2*n). (End)
%F A008441 From _Peter Bala_, Jan 05 2021: (Start)
%F A008441 G.f.: Sum_{n = -oo..oo} x^(4*n^2+2*n) * (1 + x^(4*n+1))/(1 - x^(4*n+1)). See Agarwal, p. 285, equation 6.20 with i = j = 1 and mu = 4.
%F A008441 For prime p of the form 4*k + 3, a(n*p^2 + (p^2 - 1)/4) = a(n).
%F A008441 If n > 0 and p are coprime then a(n*p + (p^2 - 1)/4) = 0. The proofs are similar to those given for the corresponding results for A115110. Cf. A000729.
%F A008441 For prime p of the form 4*k + 1 and for n not congruent to (p - 1)/4 (mod p) we have a(n*p^2 + (p^2 - 1)/4) = 3*a(n) (since b(n), where b(4*n+1) = a(n), is multiplicative). (End)
%F A008441 From _Peter Bala_, Mar 22 2021: (Start)
%F A008441 G.f. A(q) satisfies:
%F A008441 A(q^2) = Sum_{n = -oo..oo} q^n/(1 - q^(4*n+2)) (set z = q, alpha = q^2, mu = 4 in Agarwal, equation 6.15).
%F A008441 A(q^2) = Sum_{n = -oo..oo} q^(2*n)/(1 - q^(4*n+1)) (set z = q^2, alpha = q, mu = 4 in Agarwal, equation 6.15).
%F A008441 A(q^2) = Sum_{n = -oo..oo} q^n/(1 + q^(2*n+1))^2 = Sum_{n = -oo..oo} q^(3*n+1)/(1 + q^(2*n+1))^2. (End)
%F A008441 G.f.: Sum_{k>=0} a(k) * q^k = Sum_{k>=0} (-1)^k * q^(k*(k+1)) + 2 * Sum_{n>=1, k>=0} (-1)^k * q^(k*(k+2*n+1)+n). - _Mamuka Jibladze_, May 17 2021
%F A008441 G.f.: Sum_{k>=0} a(k) * q^k = Sum_{k>=0} (-1)^k * q^(k*(k+1)) * (1 + q^(2*k+1))/(1 - q^(2*k+1)). - _Mamuka Jibladze_, Jun 06 2021
%F A008441 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/2 (A019669). - _Amiram Eldar_, Oct 15 2022
%e A008441 G.f. = 1 + 2*x + x^2 + 2*x^3 + 2*x^4 + 3*x^6 + 2*x^7 + 2*x^9 + 2*x^10 + 2*x^11 + ...
%e A008441 G.f. for B(q) = q * A(q^4) = q + 2*q^5 + q^9 + 2*q^13 + 2*q^17 + 3*q^25 + 2*q^29 + 2*q^37 + 2*q^41 + ...
%p A008441 sigmamr := proc(n,m,r) local a,d ; a := 0 ; for d in numtheory[divisors](n) do if modp(d,m) = r then a := a+1 ; end if; end do: a; end proc:
%p A008441 A002654 := proc(n) sigmamr(n,4,1)-sigmamr(n,4,3) ; end proc:
%p A008441 A008441 := proc(n) A002654(4*n+1) ; end proc:
%p A008441 seq(A008441(n),n=0..90) ; # _R. J. Mathar_, Mar 23 2011
%t A008441 Plus@@((-1)^(1/2 (Divisors[4#+1]-1)))& /@ Range[0, 104] (* _Ant King_, Dec 02 2010 *)
%t A008441 a[ n_] := SeriesCoefficient[ (1/2) EllipticTheta[ 2, 0, q] EllipticTheta[ 3, 0, q], {q, 0, n + 1/4}]; (* _Michael Somos_, Jun 19 2012 *)
%t A008441 a[ n_] := SeriesCoefficient[ (1/4) EllipticTheta[ 2, 0, q]^2, {q, 0, 2 n + 1/2}]; (* _Michael Somos_, Jun 19 2012 *)
%t A008441 a[ n_] := If[ n < 0, 0, DivisorSum[ 4 n + 1, (-1)^Quotient[#, 2] &]];  (* _Michael Somos_, Jun 08 2014 *)
%t A008441 QP = QPochhammer; s = QP[q^2]^4/QP[q]^2 + O[q]^100; CoefficientList[s, q] (* _Jean-François Alcover_, Nov 27 2015, adapted from PARI *)
%t A008441 TriangleQ[n_] := IntegerQ@Sqrt[8n +1]; Table[Count[FrobeniusSolve[{1, 1}, n], {__?TriangleQ}], {n, 0, 104}] (* _Robert G. Wilson v_, Apr 15 2017 *)
%o A008441 (PARI) {a(n) = if( n<1, n==0, polcoeff( sum(k=0, (sqrtint(8*n + 1) - 1)\2, x^(k * (k+1)/2), x * O(x^n))^2, n) )};
%o A008441 (PARI) {a(n) = if( n<0, 0, n = 4*n + 1; sumdiv(n, d, (-1)^(d\2)))}; /* _Michael Somos_, Sep 02 2005 */
%o A008441 (PARI) {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x^2 + A)^4 / eta(x + A)^2, n))};
%o A008441 (PARI) {a(n) = if( n<0, 0, n = 4*n + 1; sumdiv( n, d, (d%4==1) - (d%4==3)))}; /* _Michael Somos_, Sep 14 2005 */
%o A008441 (PARI) { my(q='q+O('q^166)); Vec(eta(q^2)^4 / eta(q)^2) } \\ _Joerg Arndt_, Apr 16 2017
%o A008441 (Sage) ModularForms( Gamma1(8), 1, prec=420).1; # _Michael Somos_, Jun 08 2014
%o A008441 (Haskell)
%o A008441 a052343 = (flip div 2) . (+ 1) . a008441
%o A008441 -- _Reinhard Zumkeller_, Jul 25 2014
%o A008441 (Magma) A := Basis( ModularForms( Gamma1(8), 1), 420); A[2]; /* _Michael Somos_, Jan 31 2015 */
%Y A008441 A002654, A008442, A035154, A035181, A035184, A112301, A113406, A113414, A113446, A113652 all satisfy A(4n+1)=a(n).
%Y A008441 Cf. A004020, A005883, A104794, A052343, A199015 (partial sums).
%Y A008441 Number of ways of writing n as a sum of k triangular numbers, for k=1,...: A010054, A008441, A008443, A008438, A008439, A008440, A226252, A007331, A226253, A226254, A226255, A014787, A014809.
%Y A008441 Cf. A002175, A053692, A113407, A121444.
%Y A008441 Cf. A000217, A001938, A004018.
%Y A008441 Cf. A274621 (reciprocal series).
%Y A008441 Cf. A001826, A001842.
%Y A008441 Cf. A019669, A079006.
%K A008441 nonn,easy
%O A008441 0,2
%A A008441 _N. J. A. Sloane_
%E A008441 More terms and information from _Michael Somos_, Mar 23 2003