A087059 Difference between 2*n^2 and the next greater square number.
2, 1, 7, 4, 14, 9, 2, 16, 7, 25, 14, 1, 23, 8, 34, 17, 47, 28, 7, 41, 18, 56, 31, 4, 46, 17, 63, 32, 82, 49, 14, 68, 31, 89, 50, 9, 71, 28, 94, 49, 2, 72, 23, 97, 46, 124, 71, 16, 98, 41, 127, 68, 7, 97, 34, 128, 63, 161, 94, 25, 127, 56, 162, 89, 14, 124, 47, 161, 82, 1, 119
Offset: 1
Examples
a(10) = 25 because the difference between 2*10^2 = 200 and the next greater square number (225) is 25.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
(Floor[Sqrt[#]]+1)^2-#&/@Table[2n^2,{n,80}] (* Harvey P. Dale, Jan 15 2023 *)
-
PARI
a(n) = (1 + sqrtint(2*n^2))^2 - 2*n^2 \\ Michel Marcus, Jun 25 2013
Formula
a(n) = A087058(n) - 2*n^2 = A087057(n)^2 - 2*n^2 = (1 + A001951(n))^2 - 2*n^2 = (1 + floor(n*sqrt(2)))^2 - 2*n^2.
a(n) = 2*c(n)^2 - (n - c(n))^2, with c(n) := ceiling(n/(1 + sqrt(2))), n >= 1. - Wolfdieter Lang, Jun 11 2015
Comments