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.

A005369 a(n) = 1 if n is of the form m(m+1), else 0.

Original entry on oeis.org

1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Keywords

Comments

This is essentially the q-expansion of the Jacobi theta function theta_2(q). (In theta_2 one has to ignore the initial factor of 2*q^(1/4). See also A010054.) - N. J. A. Sloane, Aug 03 2014
For n > 0, a(n) is the number of partitions of n into two parts such that the larger part is equal to the square of the smaller part. - Wesley Ivan Hurt, Dec 23 2020

Examples

			G.f. = 1 + x^2 + x^6 + x^12 + x^20 + x^30 + x^42 + x^56 + x^72 + x^90 + ...
G.f. = q + q^9 + q^25 + q^49 + q^81 + q^121 + q^169 + q^225 + q^289 + ...
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.

Crossrefs

Cf. A002378. Partial sums give A000194.

Programs

  • Haskell
    a005369 = a010052 . (+ 1) . (* 4) -- Reinhard Zumkeller, Jul 05 2014
    
  • Maple
    A005369 := proc(n)
        if issqr(1+4*n) then
            if type( sqrt(1+4*n)-1,'even') then
                1;
            else
                0;
            end if;
        else
            0;
        end if;
    end proc:
    seq(A005369(n),n=0..80) ; # R. J. Mathar, Feb 22 2021
  • Mathematica
    a005369[n_] := If[IntegerQ[Sqrt[4 # + 1]], 1, 0] & /@ Range[0, n]; a005369[100] (* Michael De Vlieger, Jan 02 2015 *)
    a[ n_] := SquaresR[ 1, 4 n + 1] / 2; (* Michael Somos, Feb 22 2015 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 2, 0, x] / (2 x^(1/4)), {x, 0, n}]; (* Michael Somos, Feb 22 2015 *)
    QP = QPochhammer; s = QP[q^4]^2/QP[q^2] + O[q]^100; CoefficientList[s, q] (* Jean-François Alcover, Dec 01 2015, adapted from PARI *)
    nmax = 200; CoefficientList[Series[Sum[x^(k*(k + 1)), {k, 0, Sqrt[nmax]}], {x, 0, nmax}], x] (* Vaclav Kotesovec, Nov 12 2020 *)
  • PARI
    {a(n) = if( n<0, 0, issquare(4*n + 1))};
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x^4 + A)^2 / eta(x^2 + A), n))};
    
  • Python
    from sympy.ntheory.primetest import is_square
    def A005369(n): return int(is_square((n<<2)|1)) # Chai Wah Wu, Jun 07 2025

Formula

Expansion of q^(-1/4) * eta(q^4)^2 / eta(q^2) in powers of q.
Euler transform of period 4 sequence [ 0, 1, 0, -1, ...].
G.f.: Product_{k>0} (1 - x^(4*k)) / (1 - x^(4*k-2)) = f(x^2, x^6) where f(, ) is Ramanujan's general theta function.
From Michael Somos, Apr 13 2005: (Start)
Given g.f. A(x), then B(q) = (q*A(q^4))^2 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.
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*u2^2*u6 - u1*u6^3 - u3^3*u2. (End)
a(n) = b(4*n + 1) where b() = A098108() is multiplicative and b(2^e) = 0^e, b(p^e) = (1 + (-1)^e)/2 if p>2. - Michael Somos, Jun 06 2005
G.f.: 1/2 x^{-1/4}theta_2(0,x), where theta_2 is a Jacobi theta function. - Franklin T. Adams-Watters, Jun 29 2009
a(A002378(n)) = 1; a(A078358(n)) = 0. - Reinhard Zumkeller, Jul 05 2014
a(n) = floor(sqrt(n+1)+1/2)-floor(sqrt(n)+1/2). - Mikael Aaltonen, Jan 02 2015
a(2*n) = A010054(n).
a(n) = A000729(n)(mod 2). - John M. Campbell, Jul 16 2016
For n > 0, a(n) = Sum_{k=1..floor(n/2)} [k^2 = n-k], where [ ] is the Iverson bracket. - Wesley Ivan Hurt, Dec 23 2020

Extensions

Additional comments from Michael Somos, Apr 29 2003
Erroneous formula removed by Reinhard Zumkeller, Jul 05 2014