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-7 of 7 results.

A002654 Number of ways of writing n as a sum of at most two nonzero squares, where order matters; also (number of divisors of n of form 4m+1) - (number of divisors of form 4m+3).

Original entry on oeis.org

1, 1, 0, 1, 2, 0, 0, 1, 1, 2, 0, 0, 2, 0, 0, 1, 2, 1, 0, 2, 0, 0, 0, 0, 3, 2, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 1, 3, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 1, 4, 0, 0, 2, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 2, 1, 2, 0, 0, 4, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 1, 0, 3, 2, 0, 0, 2, 0
Offset: 1

Views

Author

Keywords

Comments

Glaisher calls this E(n) or E_0(n). - N. J. A. Sloane, Nov 24 2018
Number of sublattices of Z X Z of index n that are similar to Z X Z; number of (principal) ideals of Z[i] of norm n.
a(n) is also one fourth of the number of integer solutions of n = x^2 + y^2 (order and signs matter, and 0 (without signs) is allowed). a(n) = N(n)/4, with N(n) from p. 147 of the Niven-Zuckermann reference. See also Theorem 5.12, p. 150, which defines a (strongly) multiplicative function h(n) which coincides with A056594(n-1), n >= 1, and N(n)/4 = sum(h(d), d divides n). - Wolfdieter Lang, Apr 19 2013
a(2+8*N) = A008441(N) gives the number of ways of writing N as the sum of 2 (nonnegative) triangular numbers for N >= 0. - Wolfdieter Lang, Jan 12 2017
Coefficients of Dedekind zeta function for the quadratic number field of discriminant -4. See A002324 for formula and Maple code. - N. J. A. Sloane, Mar 22 2022

Examples

			4 = 2^2, so a(4) = 1; 5 = 1^2 + 2^2 = 2^2 + 1^2, so a(5) = 2.
x + x^2 + x^4 + 2*x^5 + x^8 + x^9 + 2*x^10 + 2*x^13 + x^16 + 2*x^17 + x^18 + ...
2 = (+1)^2 + (+1)^2 = (+1)^2 + (-1)^2  = (-1)^2 + (+1)^2 = (-1)^2 + (-1)^2. Hence there are 4 integer solutions, called N(2) in the Niven-Zuckerman reference, and a(2) = N(2)/4 = 1.  4 = 0^1 + (+2)^2 = (+2)^2 + 0^2 = 0^2 + (-2)^2 = (-2)^2 + 0^2. Hence N(4) = 4 and a(4) = N(4)/4 = 1. N(5) = 8, a(5) = 2. - _Wolfdieter Lang_, Apr 19 2013
		

References

  • J. M. Borwein, D. H. Bailey and R. Girgensohn, Experimentation in Mathematics, A K Peters, Ltd., Natick, MA, 2004. x+357 pp. See p. 194.
  • George Chrystal, Algebra: An elementary text-book for the higher classes of secondary schools and for colleges, 6th ed., Chelsea Publishing Co., New York, 1959, Part II, p. 346 Exercise XXI(17). MR0121327 (22 #12066)
  • Emil Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 15.
  • Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers, New York: John Wiley, 1980, pp. 147 and 150.
  • Günter Scheja and Uwe Storch, Lehrbuch der Algebra, Tuebner, 1988, p. 251.
  • 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).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 89.
  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 340.

Crossrefs

Equals 1/4 of A004018. Partial sums give A014200.
Cf. A002175, A008441, A121444, A122856, A122865, A022544, A143574, A000265, A027748, A124010, A025426 (two squares, order does not matter), A120630 (Dirichlet inverse), A101455 (Mobius transform), A000089, A241011.
If one simply reads the table in Glaisher, PLMS 1884, which omits the zero entries, one gets A213408.
Dedekind zeta functions for imaginary quadratic number fields of discriminants -3, -4, -7, -8, -11, -15, -19, -20 are A002324, A002654, A035182, A002325, A035179, A035175, A035171, A035170, respectively.
Dedekind zeta functions for real quadratic number fields of discriminants 5, 8, 12, 13, 17, 21, 24, 28, 29, 33, 37, 40 are A035187, A035185, A035194, A035195, A035199, A035203, A035188, A035210, A035211, A035215, A035219, A035192, respectively.

Programs

  • Haskell
    a002654 n = product $ zipWith f (a027748_row m) (a124010_row m) where
       f p e | p `mod` 4 == 1 = e + 1
             | otherwise      = (e + 1) `mod` 2
       m = a000265 n
    -- Reinhard Zumkeller, Mar 18 2013
    
  • Maple
    with(numtheory):
    A002654 := proc(n)
        local count1, count3, d;
        count1 := 0:
        count3 := 0:
        for d in numtheory[divisors](n) do
            if d mod 4 = 1 then
                count1 := count1+1
            elif d mod 4 = 3 then
                count3 := count3+1
            fi:
        end do:
        count1-count3;
    end proc:
    # second Maple program:
    a:= n-> add(`if`(d::odd, (-1)^((d-1)/2), 0), d=numtheory[divisors](n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 04 2020
  • Mathematica
    a[n_] := Count[Divisors[n], d_ /; Mod[d, 4] == 1] - Count[Divisors[n], d_ /; Mod[d, 4] == 3]; a/@Range[105] (* Jean-François Alcover, Apr 06 2011, after R. J. Mathar *)
    QP = QPochhammer; CoefficientList[(1/q)*(QP[q^2]^10/(QP[q]*QP[q^4])^4-1)/4 + O[q]^100, q] (* Jean-François Alcover, Nov 24 2015 *)
    f[2, e_] := 1; f[p_, e_] := If[Mod[p, 4] == 1, e + 1, Mod[e + 1, 2]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 19 2020 *)
    Rest[CoefficientList[Series[EllipticTheta[3, 0, q]^2/4, {q, 0, 100}], q]] (* Vaclav Kotesovec, Mar 10 2023 *)
  • PARI
    direuler(p=2,101,1/(1-X)/(1-kronecker(-4,p)*X))
    
  • PARI
    {a(n) = polcoeff( sum(k=1, n, x^k / (1 + x^(2*k)), x * O(x^n)), n)}
    
  • PARI
    {a(n) = sumdiv( n, d, (d%4==1) - (d%4==3))}
    
  • PARI
    {a(n) = local(A); A = x * O(x^n); polcoeff( eta(x^2 + A)^10 / (eta(x + A) * eta(x^4 + A))^4 / 4, n)} \\ Michael Somos, Jun 03 2005
    
  • PARI
    a(n)=my(f=factor(n>>valuation(n,2))); prod(i=1,#f~, if(f[i,1]%4==1, f[i,2]+1, (f[i,2]+1)%2)) \\ Charles R Greathouse IV, Sep 09 2014
    
  • PARI
    my(B=bnfinit(x^2+1)); vector(100,n,#bnfisintnorm(B,n)) \\ Joerg Arndt, Jun 01 2024
    
  • Python
    from math import prod
    from sympy import factorint
    def A002654(n): return prod(1 if p == 2 else (e+1 if p % 4 == 1 else (e+1) % 2) for p, e in factorint(n).items()) # Chai Wah Wu, May 09 2022

Formula

Dirichlet series: (1-2^(-s))^(-1)*Product (1-p^(-s))^(-2) (p=1 mod 4) * Product (1-p^(-2s))^(-1) (p=3 mod 4) = Dedekind zeta-function of Z[ i ].
Coefficients in expansion of Dirichlet series Product_p (1-(Kronecker(m, p)+1)*p^(-s)+Kronecker(m, p)*p^(-2s))^(-1) for m = -16.
If n=2^k*u*v, where u is product of primes 4m+1, v is product of primes 4m+3, then a(n)=0 unless v is a square, in which case a(n) = number of divisors of u (Jacobi).
Multiplicative with a(p^e) = 1 if p = 2; e+1 if p == 1 (mod 4); (e+1) mod 2 if p == 3 (mod 4). - David W. Wilson, Sep 01 2001
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 + 1). - Michael Somos, Jul 19 2004
G.f.: Sum_{n>=1} ((-1)^floor(n/2)*x^((n^2+n)/2)/(1+(-x)^n)). - Vladeta Jovovic, Sep 15 2004
Expansion of (eta(q^2)^10 / (eta(q) * eta(q^4))^4 - 1)/4 in powers of q.
G.f.: Sum_{k>0} x^k / (1 + x^(2*k)) = Sum_{k>0} -(-1)^k * x^(2*k - 1) / (1 - x^(2*k - 1)). - Michael Somos, Aug 17 2005
a(4*n + 3) = a(9*n + 3) = a(9*n + 6) = 0. a(9*n) = a(2*n) = a(n). - Michael Somos, Nov 01 2006
a(4*n + 1) = A008441(n). a(3*n + 1) = A122865(n). a(3*n + 2) = A122856(n). a(12*n + 1) = A002175(n). a(12*n + 5) = 2 * A121444(n). 4 * a(n) = A004018(n) unless n=0.
a(n) = Sum_{k=1..n} A010052(k)*A010052(n-k). a(A022544(n)) = 0; a(A001481(n)) > 0.
- Reinhard Zumkeller, Sep 27 2008
a(n) = A001826(n) - A001842(n). - R. J. Mathar, Mar 23 2011
a(n) = Sum_{d|n} A056594(d-1), n >= 1. See the above comment on A056594(d-1) = h(d) of the Niven-Zuckerman reference. - Wolfdieter Lang, Apr 19 2013
Dirichlet g.f.: zeta(s)*beta(s) = zeta(s)*L(chi_2(4),s). - Ralf Stephan, Mar 27 2015
G.f.: (theta_3(x)^2 - 1)/4, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 17 2018
a(n) = Sum_{ m: m^2|n } A000089(n/m^2). - Andrey Zabolotskiy, May 07 2018
a(n) = A053866(n) + 2 * A025441(n). - Andrey Zabolotskiy, Apr 23 2019
a(n) = Im(Sum_{d|n} i^d). - Ridouane Oudra, Feb 02 2020
a(n) = Sum_{d|n} sin((1/2)*d*Pi). - Ridouane Oudra, Jan 22 2021
Sum_{n>=1} (-1)^n*a(n)/n = Pi*log(2)/4 (Covo, 2010). - Amiram Eldar, Apr 07 2022
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/4 = 0.785398... (A003881). - Amiram Eldar, Oct 11 2022
From Vaclav Kotesovec, Mar 10 2023: (Start)
Sum_{k=1..n} a(k)^2 ~ n * (log(n) + C) / 4, where C = A241011 =
4*gamma - 1 + log(2)/3 - 2*log(Pi) + 8*log(Gamma(3/4)) - 12*Zeta'(2)/Pi^2 = 2.01662154573340811526279685971511542645018417752364748061...
The constant C, published by Ramanujan (1916, formula (22)), 4*gamma - 1 + log(2)/3 - log(Pi) + 4*log(Gamma(3/4)) - 12*Zeta'(2)/Pi^2 = 2.3482276258576... is wrong! (End)

A014198 Number of integer solutions to x^2 + y^2 <= n excluding (0,0).

Original entry on oeis.org

0, 4, 8, 8, 12, 20, 20, 20, 24, 28, 36, 36, 36, 44, 44, 44, 48, 56, 60, 60, 68, 68, 68, 68, 68, 80, 88, 88, 88, 96, 96, 96, 100, 100, 108, 108, 112, 120, 120, 120, 128, 136, 136, 136, 136, 144, 144, 144, 144, 148, 160, 160, 168, 176, 176, 176, 176, 176, 184, 184
Offset: 0

Views

Author

Keywords

Comments

a(32)/32 = 100/32 = 3.125; lim_{n->infinity} a(n)/n = Pi.
The terms of this sequence are four times the running total of the excess of the 4k + 1 divisors of the natural numbers (from 1 through to n) over their 4k + 3 divisors. - Ant King, Mar 12 2013

Examples

			For n=2 the 8 solutions are (x,y) = (+-1,0), (0,+-1), (+-1,+-1).
		

References

  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, th. 339

Crossrefs

Programs

  • Maple
    A014198 := proc(n)
        nops([ numtheory[thue]( abs( x^2+y^2) <= n, [ x, y ] ) ]);
    end proc:
    seq(A014198(n),n=0..60) ;
  • Mathematica
    Prepend[SquaresR[2,#] &/@Range[59],0]//Accumulate (* Ant King, Mar 12 2013 *)
  • PARI
    a(n)=local(j); j=sqrtint(n); sum(x=-j,j,sum(y=-j,j,x^2+y^2<=n))-1
    
  • Python
    from math import prod
    from itertools import count, accumulate, islice
    from sympy import factorint
    def A014198_gen(): # generator of terms
        return accumulate(map(lambda n:prod(e+1 if p & 3 == 1 else (e+1) & 1 for p, e in factorint(n).items() if p > 2) << 2, count(1)),initial=0)
    A014198_list = list(islice(A014198_gen(),30)) # Chai Wah Wu, Jun 28 2022

Formula

a(n) = 4*A014200(n).
a(n) = A057655(n)-1.

A350161 Square array T(n,k), n >= 1, k >= 1, read by antidiagonals downwards, where T(n,k) = Sum_{j=1..n} (-1)^(j+1) * floor(n/(2*j-1))^k.

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 1, 8, 8, 3, 1, 16, 26, 15, 5, 1, 32, 80, 63, 25, 5, 1, 64, 242, 255, 125, 33, 5, 1, 128, 728, 1023, 625, 209, 45, 6, 1, 256, 2186, 4095, 3125, 1281, 335, 60, 7, 1, 512, 6560, 16383, 15625, 7745, 2385, 504, 73, 9, 1, 1024, 19682, 65535, 78125, 46593, 16775, 4080, 703, 95, 9
Offset: 1

Views

Author

Seiichi Manyama, Dec 18 2021

Keywords

Examples

			Square array begins:
  1,  1,   1,    1,     1,      1,      1, ...
  2,  4,   8,   16,    32,     64,    128, ...
  2,  8,  26,   80,   242,    728,   2186, ...
  3, 15,  63,  255,  1023,   4095,  16383, ...
  5, 25, 125,  625,  3125,  15625,  78125, ...
  5, 33, 209, 1281,  7745,  46593, 279809, ...
  5, 45, 335, 2385, 16775, 117585, 823415, ...
		

Crossrefs

Columns k=1..3 give A014200, A350162, A350163.
T(n,n) gives A350164.

Programs

  • Mathematica
    T[n_, k_] := Sum[(-1)^(j + 1) * Floor[n/(2*j - 1)]^k, {j, 1, n}]; Table[T[k, n - k + 1], {n, 1, 11}, {k, 1, n}] // Flatten (* Amiram Eldar, Dec 18 2021 *)
  • PARI
    T(n, k) = sum(j=1, n, (-1)^(j+1)*(n\(2*j-1))^k);
    
  • PARI
    T(n, k) = sum(j=1, n, sumdiv(j, d, kronecker(-4, j/d)*(d^k-(d-1)^k)));

Formula

G.f. of column k: (1/(1 - x)) * Sum_{j>=1} (j^k - (j - 1)^k) * x^j/(1 + x^(2*j)).
T(n,k) = Sum_{j=1..n} Sum_{d|j} A101455(j/d) * (d^k - (d - 1)^k).

A014202 Number of solutions to x^2 + x*y + y^2 <= n, excluding (0,0), divided by 6.

Original entry on oeis.org

0, 1, 1, 2, 3, 3, 3, 5, 5, 6, 6, 6, 7, 9, 9, 9, 10, 10, 10, 12, 12, 14, 14, 14, 14, 15, 15, 16, 18, 18, 18, 20, 20, 20, 20, 20, 21, 23, 23, 25, 25, 25, 25, 27, 27, 27, 27, 27, 28, 31, 31, 31, 33, 33, 33, 33, 33, 35, 35, 35
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • PARI
    a(n)=if(n<1,0,sum(k=1,n,kronecker(k,3)*floor(n/k))) \\ Benoit Cloitre, Oct 31 2009

Formula

For n > 0, a(n) = Sum_{k=1..n} K(k,3)*floor(n/k) where K(x,y) is the Kronecker symbol. - Benoit Cloitre, Oct 31 2009

A309124 a(n) = n - 3 * floor(n/3) + 5 * floor(n/5) - 7 * floor(n/7) + ...

Original entry on oeis.org

1, 2, 0, 1, 7, 5, -1, 0, 7, 13, 3, 1, 15, 9, -3, -2, 16, 23, 5, 11, 23, 13, -9, -11, 20, 34, 14, 8, 38, 26, -4, -3, 17, 35, -1, 6, 44, 26, -2, 4, 46, 58, 16, 6, 48, 26, -20, -22, 21, 52, 16, 30, 84, 64, 4, -2, 34, 64, 6, -6, 56, 26, -16, -15, 69, 89, 23, 41, 85, 49, -21, -14, 60, 98, 36
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 13 2019

Keywords

Comments

Partial sums of A050457.

Crossrefs

Programs

  • Maple
    f:= proc(n) local r,d;
      r:= n/2^padic:-ordp(n,2);
      add((-1)^((d-1)/2)*d, d = numtheory:-divisors(r))
    end proc:
    ListTools:-PartialSums(map(f,[$1..100])); # Robert Israel, Oct 28 2020
  • Mathematica
    Table[Sum[(-1)^(k + 1) (2 k - 1) Floor[n/(2 k - 1)], {k, 1, n}], {n, 1, 75}]
    nmax = 75; CoefficientList[Series[1/(1 - x) Sum[(-1)^(k + 1) (2 k - 1) x^(2 k - 1)/(1 - x^(2 k - 1)), {k, 1, nmax}], {x, 0, nmax}], x] // Rest

Formula

G.f.: (1/(1 - x)) * Sum_{k>=1} (-1)^(k+1) * (2*k - 1) * x^(2*k-1)/(1 - x^(2*k-1)).

A350162 a(n) = Sum_{k=1..n} (-1)^(k+1) * floor(n/(2*k-1))^2.

Original entry on oeis.org

1, 4, 8, 15, 25, 33, 45, 60, 73, 95, 115, 131, 157, 181, 205, 236, 270, 297, 333, 379, 403, 443, 487, 519, 578, 632, 672, 720, 778, 826, 886, 949, 989, 1059, 1131, 1186, 1260, 1332, 1388, 1482, 1564, 1612, 1696, 1776, 1858, 1946, 2038, 2102, 2187, 2308, 2380, 2490
Offset: 1

Views

Author

Seiichi Manyama, Dec 18 2021

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[(-1)^(k + 1) * Floor[n/(2*k - 1)]^2, {k, 1, n}]; Array[a, 50] (* Amiram Eldar, Dec 18 2021 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^(k+1)*(n\(2*k-1))^2);
    
  • PARI
    a(n) = sum(k=1, n, sumdiv(k, d, kronecker(-4, k/d)*(2*d-1)));
    
  • PARI
    my(N=66, x='x+O('x^N)); Vec(sum(k=1, N, (2*k-1)*x^k/(1+x^(2*k)))/(1-x))

Formula

a(n) = Sum_{k=1..n} Sum_{d|k} A101455(k/d) * (2*d - 1) = Sum_{k=1..n} 2 * A050469(k) - A002654(k) = 2 * A350166(n) - A014200(n).
G.f.: (1/(1 - x)) * Sum_{k>=1} (2*k - 1) * x^k/(1 + x^(2*k)).

A036698 a(n) is the number of Gaussian integers z=a+bi satisfying |z|<=n, a>0, b>=0.

Original entry on oeis.org

0, 1, 3, 7, 12, 20, 28, 37, 49, 63, 79, 94, 110, 132, 153, 177, 199, 225, 252, 282, 314, 343, 379, 413, 448, 490, 530, 572, 613, 657, 705, 750, 802, 852, 906, 963, 1013, 1073, 1128, 1194, 1256, 1315, 1381, 1447, 1519, 1590, 1656
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • C
    typedef unsigned long ulong;
    ulong A036698(ulong i)
    {
        const ulong ring = i*i;
        ulong result = 0;
        for(ulong a = 1; a <= i; a++)
        {
            const ulong a2 = a*a;
            for(ulong b = 0; b <= i; b++)
            {
                ulong z = a2 + b*b;
                if ( ring >= z ) result++;
            }
        }
        return result;
    } /* Oskar Wieland, Apr 02 2013 */
    
  • PARI
    a(n)=my(n2=n^2);sum(a=1,n,sqrtint(n2-a^2)+1) \\ Charles R Greathouse IV, Apr 03 2013
    
  • PARI
    a(n) = sum(k=1, n^2, sumdiv(k, d, kronecker(-4, k/d))); \\ Seiichi Manyama, Dec 20 2021

Formula

a(n) = A000603(n) - n - 1.
a(n) = n^2 * Pi/4 + O(n). - Charles R Greathouse IV, Apr 03 2013
a(n) = A014200(n^2). - Seiichi Manyama, Dec 20 2021
Showing 1-7 of 7 results.