login
A278818
a(n) is the least k > n such that k + n is square.
2
1, 3, 7, 6, 5, 11, 10, 9, 17, 16, 15, 14, 13, 23, 22, 21, 20, 19, 31, 30, 29, 28, 27, 26, 25, 39, 38, 37, 36, 35, 34, 33, 49, 48, 47, 46, 45, 44, 43, 42, 41, 59, 58, 57, 56, 55, 54, 53, 52, 51, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 83, 82, 81, 80, 79, 78
OFFSET
0,2
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
A278818:=n->ceil(sqrt(2*n+1))^2-n: seq(A278818(n), n=0..100); # Wesley Ivan Hurt, Dec 01 2016
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
Cf. A072905.
Sequence in context: A188734 A021883 A338065 * A245259 A075785 A105735
KEYWORD
nonn,easy
AUTHOR
Peter Kagey, Nov 28 2016
STATUS
approved