A087056 Difference between 2 * n^2 and the next smaller square number.
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
Examples
a(10) = 4 because the difference between 2*10^2 = 200 and the next smaller square number (196) is 4.
Programs
-
PARI
a(n) = 2*n^2 - sqrtint(2*n^2)^2; \\ Michel Marcus, Jul 08 2020
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
Comments