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.

A248333 Number of unit squares enclosed by n lattice points in and along the first quadrant of the coordinate plane starting from (0,0) and moving along each square gnomon starting on the y-axis and ending on the x-axis.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59
Offset: 0

Views

Author

Wesley Ivan Hurt, Oct 04 2014

Keywords

Comments

For n > 0, the pattern fails to add a square if n is of the form k^2+1 (A002522) or k^2-k+1 (A002061). Taken together, these numbers are: 1, 2, 3, 5, 7, 10, 13, 17, ... All other numbers add one unit square to the pattern (see example).

Examples

			Figure 1:                                                            .
                                 .     . .   . . .   . . .   . . .   . . .
                 .    . .  . .   . .   . .   . .     . . .   . . .   . . .
            .    .    .    . .   . .   . .   . .     . .     . . .   . . .
       -------------------------------------------------------------------
n:     0    1    2    3    4     5     6     7       8       9       10
a(n):  0    0    0    0    1     1     2     2       3       4       4
--                                                             .
       . .     . . .   . . . .   . . . .   . . . .   . . . .   . . . .
       . . .   . . .   . . .     . . . .   . . . .   . . . .   . . . .
       . . .   . . .   . . .     . . .     . . . .   . . . .   . . . .
       . . .   . . .   . . .     . . .     . . .     . . . .   . . . .
       -------------------------------------------------------------------
n:     11      12      13        14        15        16        17
a(n):  5       6       6         7         8         9         9
--
n = 4 -->(0,0), (0,1), (1,1), (1,0) enclose one unit square.
n = 5 -->(0,0), (0,1), (1,1), (1,0), (0,2) also enclose one unit square.
n = 6 -->(0,0), (0,1), (1,1), (1,0), (0,2), (1,2) enclose two unit squares.
		

Crossrefs

Cf. A002061 (n^2-n+1), A002522 (n^2+1).

Programs

  • Maple
    A248333:=n->add(`if`(issqr(i-1) or issqr(floor(i-sqrt(i-1))),0,1),i=1..n): seq(A248333(n), n=0..100);
  • PARI
    a(n) = sum(i=1, n, !(issquare(i-1) || issquare(floor(i-sqrt(i-1))))); \\ Michel Marcus, Mar 21 2021