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.

A000194 n appears 2n times, for n >= 1; also nearest integer to square root of n.

Original entry on oeis.org

0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 0

Views

Author

Keywords

Comments

Define the oblong root obrt(x) to be the (larger) solution of y * (y+1) = x; i.e., obrt(x) = sqrt(x+1/4) - 1/2. So obrt(x) is an integer iff x is an oblong number (A002378). Then a(n) = ceiling(obrt(n)). - Franklin T. Adams-Watters, Jun 24 2015
From Wolfdieter Lang, Mar 12 2019: (Start)
The general Pell equation is related to the non-reduced form F(n) = Xvec^T A(n) Xvec = x^2 - D(n)*y^2 with D(n) = A000037(n) (D not a square), Xvec = (x,y)^T (T for transposed) and A(n) = matrix[[1,0], [0,-D(n)]]. The discriminant of F(n) = [1, 0, -D(n)] is 4*D(n).
The first reduced form appears after two applications of an equivalence transformation A' = R^T A R obtained with R = R(t) = matrix([0, -1], [1, t]), namely first with t = 0, leading to the still not reduced form [-D, 0, 1], and then with t = ceiling(f(4*D(n))/2 - 1), where f(4*D(n)) = ceiling(2*sqrt(D(n))). This can be shown to be a(n), which is also D(n) - n, for n >= 1 (see a formula below).
This leads to the reduced form FR(n) = [1, 2*a(n), -(D(n) - a(n)^2)] = [1, 2*a(n), -(n - a(n)*(a(n) - 1))]. Example: n = 5, a(5) = 2: D(5) = 7 and FR(5) = [1, 4, -3]. (End)

Examples

			G.f. = x + x^2 + 2*x^3 + 2*x^4 + 2*x^5 + 2*x^6 + 3*x^7 + 3*x^8 + 3*x^9 + 3*x^10 + ...
		

References

  • Titu Andreescu, Dorin Andrica, and Zuming Feng, 104 Number Theory Problems, Birkhäuser, 2006, 59-60.
  • B. C. Berndt, Ramanujan's Notebooks Part IV, Springer-Verlag, see p. 78, Entry 24.

Crossrefs

Partial sums of A005369.
Cf. A000196 (floor(sqrt(n))), A003059 (ceiling(sqrt(n))).

Programs

  • Haskell
    a000194 n = a000194_list !! (n-1)
    a000194_list = concat $ zipWith ($) (map replicate [2,4..]) [1..]
    -- Reinhard Zumkeller, Mar 18 2011
    
  • Maple
    Digits := 100; f := n->round(evalf(sqrt(n))); [ seq(f(n), n=0..100) ];
    # More efficient:
    a := n -> isqrt(n): seq(a(n), n=0..98); # Peter Luschny, Mar 13 2019
  • Mathematica
    A000194[n_] := Floor[(1 + Sqrt[4 n - 3])/2]; (* Enrique Pérez Herrero, Apr 14 2010 *)
    Flatten[Table[PadRight[{}, 2 n, n], {n, 10}]] (* Harvey P. Dale, Nov 16 2011 *)
    CoefficientList[Series[x QPochhammer[-x^2, x^4] QPochhammer[x^8, x^8]/(1 - x), {x, 0, 50}], x] (* Eric W. Weisstein, Jan 10 2024 *)
  • PARI
    {a(n) = ceil( sqrtint(4*n) / 2)}; /* Michael Somos, Feb 11 2004 */
    
  • PARI
    a(n)=(sqrtint(4*n) + 1)\2 \\ Charles R Greathouse IV, Jun 08 2020
    
  • PARI
    apply( {A000194(n)=sqrtint(4*n)\/2}, [0..99]) \\ M. F. Hasler, Jun 22 2024
    
  • Python
    from math import isqrt
    def A000194(n): return (m:=isqrt(n))+int(n-m*(m+1)>=1) # Chai Wah Wu, Jul 30 2022

Formula

a(n) = A000037(n) - n.
G.f.: x * f(x^2, x^6)/(1-x) where f(,) is Ramanujan's two-variable theta function. - Michael Somos, May 31 2000
a(n) = a(n - 2*a(n - a(n-1))) + 1. - Benoit Cloitre, Oct 27 2002
a(n+1) = a(n) + A005369(n).
a(n) = floor((1/2)*(1 + sqrt(4*n - 3))). - Zak Seidov, Jan 18 2006
a(n) = A000037(n) - n. - Jaroslav Krizek, Jun 14 2009
a(n) = floor(A027434(n)/2). - Gregory R. Bryant, Apr 17 2013
From Mikael Aaltonen, Jan 17 2015: (Start)
a(n) = floor(sqrt(n) + 1/2).
a(n) = sqrt(A053187(n)). (End)
a(0) = 0, and a(n) = k for k from the closed interval [k^2 - k + 1, k*(k+1)] = [A002061(k), A002378(k)], for k >= 1. See A053187. - Wolfdieter Lang, Mar 12 2019
a(n) = floor(2*sqrt(n)) - floor(sqrt(n)). - Ridouane Oudra, Jun 08 2020
Sum_{n>=1} 1/a(n)^s = 2*zeta(s-1), for s > 2 (Borwein, 1994). - Amiram Eldar, Oct 31 2020

Extensions

Additional comments from Michael Somos, May 31 2000
Edited by M. F. Hasler, Mar 01 2014
Initial 0 added by N. J. A. Sloane, Nov 13 2017