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.

A056847 Nearest integer to n - sqrt(n).

Original entry on oeis.org

0, 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
Offset: 0

Views

Author

N. J. A. Sloane, Dec 07 2000

Keywords

References

  • B. Alspach, K. Heinrich and G. Liu, Orthogonal factorizations of graphs, pp. 13-40 of Contemporary Design Theory, ed. J. H. Dinizt and D. R. Stinson, Wiley, 1992 (see Theorem 2.7).

Crossrefs

Programs

  • Magma
    [n-Floor(Sqrt(n)+1/2):n in [0..80]]; // Marius A. Burtea, May 13 2019
    
  • Maple
    0,seq(seq(n-k, n=k^2-k+1..k^2+k),k=1..10); # Robert Israel, Jun 13 2018
  • Mathematica
    Table[Round[n-Sqrt[n]],{n,0,70}] (* Harvey P. Dale, Jun 15 2014 *)
  • PARI
    a(n) = round(n - sqrt(n)); \\ Michel Marcus, May 13 2019
    
  • Python
    from math import isqrt
    def A056847(n): return n-(m:=isqrt(n))-int(n>m*(m+1)) # Chai Wah Wu, Jun 05 2025

Formula

From Robert Israel, Jun 13 2018: (Start)
a(n) = n-k for k^2-k+1 <= n <= k^2+k, k >= 1.
G.f.: x/(1-x)^2 - Theta_2(0,x)*x^(3/4)/(2*(1-x)) where Theta_2 is a Jacobi theta function. (End)
a(n) = n - floor(sqrt(n) + 1/2) = n - A000194(n). - Ridouane Oudra, May 13 2019