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.

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