OFFSET
0,2
LINKS
Peter Kagey, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = ceiling(sqrt(2n+1))^2 - n. - Jon E. Schoenfield, Nov 28 2016
EXAMPLE
a(1) = 3 because 1 + 3 = 4 is square, but 1 + k is not square for 1 < k < 3.
a(2) = 7 because 2 + 7 = 9 is square, but 2 + k is not square for 2 < k < 7.
a(3) = 6 because 3 + 6 = 9 is square, but 3 + k is not square for 3 < k < 6.
MAPLE
MATHEMATICA
f[n_] := Ceiling[Sqrt[2 n + 1]]^2 - n; Array[f, 70, 0] (* Robert G. Wilson v, Nov 28 2016 *)
PROG
(Ruby)
def a(n)
(n + 1..Float::INFINITY).find { |i| n + i == ((n + i)**0.5).to_i**2 }
end
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Peter Kagey, Nov 28 2016
STATUS
approved