OFFSET
1,2
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
FORMULA
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
EXAMPLE
a(10) = 4 because the difference between 2*10^2 = 200 and the next smaller square number (196) is 4.
PROG
(PARI) a(n) = 2*n^2 - sqrtint(2*n^2)^2; \\ Michel Marcus, Jul 08 2020
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jens Voß, Aug 07 2003
STATUS
approved