%I #97 Nov 24 2024 01:49:31
%S 1,2,3,3,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,9,10,10,10,10,10,11,
%T 11,11,11,11,11,12,12,12,12,12,12,13,13,13,13,13,13,13,14,14,14,14,14,
%U 14,14,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17
%N Integer part of square root of 4n+1.
%C 1^1, 2^1, 3^2, 4^2, 5^3, 6^3, 7^4, 8^4, 9^5, 10^5, ...
%C Start with n, repeatedly subtract the square root of the previous term; a(n) gives number of steps to reach 0. - _Robert G. Wilson v_, Jul 22 2002
%C Triangle A094727 read by diagonals. - _Philippe Deléham_, Mar 21 2014
%C Partial sums of A240025; a(n) = number of quarter squares <= n. - _Reinhard Zumkeller_, Jul 05 2014
%C Every number k is present consecutively (floor((2*k+3)/4)) times. - _Bernard Schott_, Jun 08 2019
%D Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 73, problem 20.
%D Bruce C. Berndt, Ramanujan's Notebooks Part IV, Springer-Verlag, 1994, see p. 77, Entry 23.
%H T. D. Noe, <a href="/A000267/b000267.txt">Table of n, a(n) for n = 0..10000</a>
%H Gal Cohensius, Urban Larsson, Reshef Meir, and David Wahlstedt, <a href="https://arxiv.org/abs/1805.09368">Cumulative subtraction games</a>, arXiv:1805.09368 [math.CO], 2018-2020.
%H S. Ramanujan, <a href="http://www.imsc.res.in/~rao/ramanujan/CamUnivCpapers/question/q723.htm">Question 723</a>, J. Ind. Math. Soc., Vol. 7 (1915), p. 240, Vol. 10 (1918), pp. 357-358.
%F floor(a(n)/2) = A000196(n).
%F a(n) = 1 + a(n - floor(n^(1/2))), if n>0. - _Michael Somos_, Jul 22 2002
%F a(n) = floor( 1 / ( sqrt(n + 1) - sqrt(n) ) ). - Robert A. Stump (bob_ess107(AT)yahoo.com), Apr 07 2003
%F a(n) = |{floor(n/k): k in Z+}|. - _David W. Wilson_, May 26 2005
%F a(n) = ceiling(2*sqrt(n+1) - 1). - _Mircea Merca_, Feb 03 2012
%F a(n) = A000196(A016813(n)). - _Reinhard Zumkeller_, Dec 13 2012
%F a(n) = A070939(A227368(n+1)), conjectured. - _Antti Karttunen_, Dec 28 2013
%F a(n) = floor( sqrt(n) + sqrt(n+2) ). [_Bruno Berselli_, Jan 08 2015]
%F a(n) = floor( sqrt(4*n + k) ) where k = 1, 2, or 3. - _Michael Somos_, Mar 11 2015
%F G.f.: (Sum_{k>0} x^floor(k^2 / 4)) / (1 - x). - _Michael Somos_, Mar 11 2015
%F a(n) = 1 + A055086(n). - _Michael Somos_, Sep 02 2017
%F a(n) = floor(sqrt(n+1)+1/2) + floor(sqrt(n)). - _Ridouane Oudra_, Jun 07 2019
%F Sum_{k>=0} (-1)^k/a(k) = Pi/8 + log(2)/4. - _Amiram Eldar_, Jan 26 2024
%e From _Philippe Deléham_, Mar 21 2014: (Start)
%e Triangle A094727 begins:
%e 1;
%e 2, 3;
%e 3, 4, 5;
%e 4, 5, 6, 7;
%e 5, 6, 7, 8, 9;
%e 6, 7, 8, 9, 10, 11; ...
%e Read by diagonals:
%e 1;
%e 2;
%e 3, 3;
%e 4, 4;
%e 5, 5, 5;
%e 6, 6, 6;
%e 7, 7, 7, 7;
%e 8, 8, 8, 8;
%e 9, 9, 9, 9, 9;
%e 10, 10, 10, 10, 10; (End)
%e G.f. = 1 + 2*x + 3*x^2 + 3*x^3 + 4*x^4 + 4*x^5 + 5*x^6 + 5*x^7 + 5*x^8 + 6*x^9 + ...
%p A000267:=seq(floor(sqrt(4*n+1)), n=0..100); // _Bernard Schott_, Jun 08 2019
%t Table[Floor[Sqrt[4*n + 1]], {n, 0, 100}] (* _T. D. Noe_, Jun 19 2012 *)
%o (PARI) {a(n) = if( n<0, 0, sqrtint(4*n + 1))};
%o (Haskell)
%o a000267 = a000196 . a016813 -- _Reinhard Zumkeller_, Dec 13 2012
%o (Magma) [Floor(Sqrt(4*n+1)): n in [0..100]]; // _Vincenzo Librandi_, Jun 08 2019
%o (Python)
%o from math import isqrt
%o def A000267(n): return isqrt((n<<2)|1) # _Chai Wah Wu_, Nov 23 2024
%Y Cf. A055086, A080037, A227368.
%Y Cf. A000196, A002620, A016813, A070939, A094727, A240025.
%K nonn,easy,nice,tabf
%O 0,2
%A _N. J. A. Sloane_
%E More terms from _Michael Somos_, Jun 13 2000