cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A278818 a(n) is the least k > n such that k + n is square.

Original entry on oeis.org

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

Views

Author

Peter Kagey, Nov 28 2016

Keywords

Examples

			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.
		

Crossrefs

Cf. A072905.

Programs

  • 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 *)
  • Ruby
    def a(n)
      (n + 1..Float::INFINITY).find { |i| n + i == ((n + i)**0.5).to_i**2 }
    end

Formula

a(n) = ceiling(sqrt(2n+1))^2 - n. - Jon E. Schoenfield, Nov 28 2016