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.

A384797 a(n) = A047800(n) - A047800(n-1).

Original entry on oeis.org

2, 3, 4, 5, 5, 7, 7, 8, 9, 10, 10, 12, 11, 12, 14, 15, 13, 17, 15, 18, 18, 19, 17, 21, 21, 21, 22, 23, 22, 26, 23, 26, 27, 24, 28, 31, 28, 29, 29, 34, 28, 34, 32, 32, 37, 34, 35, 38, 36, 38, 38, 39, 34, 40, 42, 44, 43, 44, 42, 49, 42, 42, 46, 45, 51, 50, 46, 47, 50
Offset: 1

Views

Author

Hugo Pfoertner, Jun 17 2025

Keywords

Comments

This is the number of distinct positive distances of the [0,n] X [0,n] points of a lattice square from the origin that are added when the size of the square is increased from n-1 to n. Among the newly added squared distances n^2, n^2+1^2, n^2+2^2, ..., n^2+n^2, some may already have occurred in smaller lattice point squares and are therefore not counted.

Examples

			a(1) = 2: Newly added squared distances are 1 and 2.
a(5) = 5: The squared distance 25=5^2+0^2 already occurs as 4^2+3^2.
a(13) = 11: There are 3 already represented squared distances, 13^2+0^2=12^2+5^2, 13^2+1^2=11^2+7^2, 13^2+4^2=11^2+8^2.
		

Crossrefs

Programs

  • Python
    def A384797(n):
        s = set(i**2+j**2 for i in range(n) for j in range(i+1))
        return n+1-sum(1 for i in range(n+1) if n**2+i**2 in s) # Chai Wah Wu, Jul 07 2025