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.

A087056 Difference between 2 * n^2 and the next smaller square number.

Original entry on oeis.org

1, 4, 2, 7, 1, 8, 17, 7, 18, 4, 17, 32, 14, 31, 9, 28, 2, 23, 46, 16, 41, 7, 34, 63, 25, 56, 14, 47, 1, 36, 73, 23, 62, 8, 49, 92, 34, 79, 17, 64, 113, 47, 98, 28, 81, 7, 62, 119, 41, 100, 18, 79, 142, 56, 121, 31, 98, 4, 73, 144, 46, 119, 17, 92, 169, 63, 142, 32, 113, 196, 82
Offset: 1

Views

Author

Jens Voß, Aug 07 2003

Keywords

Comments

The difference x - y between the legs of primitive Pythagorean triangles x^2 + y^2 = z^2 with even y is D(n, m) = n^2 - m^2 - 2*n*m (see A249866 for the restrictions on n and m to have primitive triangles, which are not used here except for 1 < = m <= n-1). Here a(n) is for positive D values the smallest number in row n, namely D(n, floor(n/(1 + sqrt(2)))), for n >= 3. For the smallest value |D| for negative D in row n >= 2 see A087059. - Wolfdieter Lang, Jun 11 2015

Examples

			a(10) = 4 because the difference between 2*10^2 = 200 and the next smaller square number (196) is 4.
		

Crossrefs

Programs

  • PARI
    a(n) = 2*n^2 - sqrtint(2*n^2)^2; \\ Michel Marcus, Jul 08 2020

Formula

a(n) = 2*n^2 - A087055(n) = 2*n^2 - A001951(n)^2 = 2*n^2 - (floor[n*sqrt(2)])^2
a(n) = (n - f(n))^2 - 2*f(n)^2 with f(n) = floor(n/(1 + sqrt(2))), for n >= 1 (the values for n = 1, 2 have here been included). See comment above. - Wolfdieter Lang, Jun 11 2015