A000194 n appears 2n times, for n >= 1; also nearest integer to square root of n.
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
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.
Links
- T. D. Noe, Table of n, a(n) for n = 0..1000
- Jonathan M. Borwein and others, Nearest Integer Zeta Functions, solution to Problem 10212, The American Mathematical Monthly, Vol. 101, No. 6 (1994), pp. 579-580.
- G. Gutin, Problem 913 (BCC20.5), Mediated digraphs, in Research Problems from the 20th British Combinatorial Conference, Discrete Math., 308 (2008), 621-630.
- M. A. Nyblom, Some curious sequences involving floor and ceiling functions, Am. Math. Monthly 109 (#6, 2002), 559-564.
- Michael Somos, Sequences used for indexing triangular or square arrays.
- Eric Weisstein's World of Mathematics, Ramanujan Theta Functions.
Crossrefs
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
Comments