login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A000196 Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times. 331

%I #189 Sep 02 2023 02:26:10

%S 0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,

%T 5,5,6,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,7,8,8,8,8,

%U 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,9,10,10

%N Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times.

%C Also the integer part of the geometric mean of the divisors of n. - _Amarnath Murthy_, Dec 19 2001

%C Number of numbers k (<= n) with an odd number of divisors. - _Benoit Cloitre_, Sep 07 2002

%C Also, for n > 0, the number of digits when writing n in base where place values are squares, cf. A007961; A190321(n) <= a(n). - _Reinhard Zumkeller_, May 08 2011

%C The least monotonic left inverse of squares, A000290. That is, the lexicographically least nondecreasing sequence a(n) such that a(A000290(n)) = n. - _Antti Karttunen_, Oct 06 2017

%D Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, p. 73, problem 23.

%D Lionel Levine, Fractal sequences and restricted Nim, Ars Combin. 80 (2006), 113-127.

%D Paul J. McCarthy, Introduction to Arithmetical Functions, Springer Verlag, 1986, p. 28.

%D N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

%H Franklin T. Adams-Watters, <a href="/A000196/b000196.txt">Table of n, a(n) for n = 0..10000</a>

%H Krassimir Atanassov, <a href="http://www.gallup.unm.edu/~smarandache/Atanassov-SomeProblems.pdf">On Some of Smarandache's Problems</a>

%H Krassimir Atanassov, <a href="https://nntdm.net/volume-05-1999/number-3/94-96/">On the 100-th, the 101-st and 102-nd Smarandache's problems</a>, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 5 (1999), No. 3, 94-96.

%H Henry Bottomley, <a href="/A000196/a000196.gif">Illustration of A000196, A048760, A053186</a>.

%H Matthew Hyatt and Marina Skyers, <a href="http://www.emis.de/journals/INTEGERS/papers/p17/p17.Abstract.html">On the Increases of the Sequence floor(k*sqrt(n))</a>, Electronic Journal of Combinatorial Number Theory, Volume 15 (2015), #A17.

%H Lionel Levine, <a href="https://arxiv.org/abs/math/0409408">Fractal sequences and restricted Nim</a>, arXiv:math/0409408 [math.CO], 2004.

%H Paul Pollack and Joseph Vandehey, <a href="http://www.jstor.org/stable/10.4169/amer.math.monthly.122.8.757">Besicovitch, Bisection, and the Normality of 0.(1)(4)(9)(16)(25)....</a>, The American Mathematical Monthly 122.8 (2015): 757-765.

%H N. J. A. Sloane, <a href="/A115004/a115004.txt">Families of Essentially Identical Sequences</a>, Mar 24 2021 (Includes this sequence)

%H Florentin Smarandache, <a href="http://www.gallup.unm.edu/~smarandache/OPNS.pdf">Only Problems, Not Solutions!</a>, 1993.

%F a(n) = Card(k, 0 < k <= n such that k is relatively prime to core(k)) where core(x) is the squarefree part of x. - _Benoit Cloitre_, May 02 2002

%F a(n) = a(n-1) + floor(n/(a(n-1)+1)^2), a(0) = 0. - _Reinhard Zumkeller_, Apr 12 2004

%F From _Hieronymus Fischer_, May 26 2007: (Start)

%F a(n) = Sum_{k=1..n} A010052(k).

%F G.f.: g(x) = (1/(1-x))*Sum_{j>=1} x^(j^2) = (theta_3(0, x) - 1)/(2*(1-x)) where theta_3 is a Jacobi theta function. (End)

%F a(n) = floor(A000267(n)/2). - _Reinhard Zumkeller_, Jun 27 2011

%F a(n) = floor(sqrt(n)). - _Arkadiusz Wesolowski_, Jan 09 2013

%F Sum_{n>0} 1/a(n)^s = 2*zeta(s-1) + zeta(s), where zeta is the Riemann zeta function. - _Enrique PĂ©rez Herrero_, Oct 15 2013

%F From _Wesley Ivan Hurt_, Dec 31 2013: (Start)

%F a(n) = Sum_{i=1..n} (A000005(i) mod 2), n > 0.

%F a(n) = (1/2)*Sum_{i=1..n} (1 - (-1)^A000005(i)), n > 0. (End)

%F a(n) = sqrt(A048760(n)), n >= 0. - _Wolfdieter Lang_, Mar 24 2015

%F a(n) = Sum_{k=1..n} floor(n/k)*lambda(k) = Sum_{m=1..n} Sum_{d|m} lambda(d) where lambda(j) is Liouville lambda function, A008836. - _Geoffrey Critzer_, Apr 01 2015

%F Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - _Amiram Eldar_, May 02 2023

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

%p Digits := 100; A000196 := n->floor(evalf(sqrt(n)));

%t Table[n, {n, 0, 20}, {2n + 1}] //Flatten (* _Zak Seidov_ Mar 19 2011 *)

%t IntegerPart[Sqrt[Range[0, 110]]] (* _Harvey P. Dale_, May 23 2012 *)

%t Floor[Sqrt[Range[0, 99]]] (* _Alonso del Arte_, Dec 31 2013 *)

%t a[ n_] := SeriesCoefficient[ (EllipticTheta[ 3, 0, x] - 1) / (2 (1 - x)), {x, 0, n}]; (* _Michael Somos_, May 28 2014 *)

%o (Magma) [Isqrt(n) : n in [0..100]];

%o (PARI) {a(n) = if( n<0, 0, floor(sqrt(n)))};

%o (PARI) {a(n) = if( n<0, 0, sqrtint(n))};

%o (Haskell)

%o import Data.Bits (shiftL, shiftR)

%o a000196 :: Integer -> Integer

%o a000196 0 = 0

%o a000196 n = newton n (findx0 n 1) where

%o -- find x0 == 2^(a+1), such that 4^a <= n < 4^(a+1).

%o findx0 0 b = b

%o findx0 a b = findx0 (a `shiftR` 2) (b `shiftL` 1)

%o newton n x = if x' < x then newton n x' else x

%o where x' = (x + n `div` x) `div` 2

%o a000196_list = concat $ zipWith replicate [1,3..] [0..]

%o -- _Reinhard Zumkeller_, Apr 12 2012, Oct 23 2010

%o (Python)

%o # from http://code.activestate.com/recipes/577821-integer-square-root-function/

%o def A000196(n):

%o if n < 0:

%o raise ValueError('only defined for nonnegative n')

%o if n == 0:

%o return 0

%o a, b = divmod(n.bit_length(), 2)

%o j = 2**(a+b)

%o while True:

%o k = (j + n//j)//2

%o if k >= j:

%o return j

%o j = k

%o print([A000196(n)for n in range(102)])

%o # _Jason Kimberley_, Nov 09 2016

%o (Python)

%o from math import isqrt

%o def a(n): return isqrt(n)

%o print([a(n) for n in range(102)]) # _Michael S. Branicky_, Feb 15 2023

%o (Scheme)

%o ;; The following implementation uses higher order function LEFTINV-LEASTMONO-NC2NC from my IntSeq-library. It returns the least monotonic left inverse of any strictly growing function (see the comment-section for the definition) and although it does not converge as fast to the result as many specialized integer square root algorithms, at least it does not involve any floating point arithmetic. Thus with correctly implemented bignums it will produce correct results even with very large arguments, in contrast to just taking the floor of (sqrt n).

%o ;; Source of LEFTINV-LEASTMONO-NC2NC can be found under https://github.com/karttu/IntSeq/blob/master/src/Transforms/transforms-core.ss and the definition of A000290 is given under that entry.

%o (define A000196 (LEFTINV-LEASTMONO-NC2NC 0 0 A000290)) ;; _Antti Karttunen_, Oct 06 2017

%Y Cf. A000290, A002162, A003056, A028391, A048760, A048766, A074704, A079051.

%Y Column k=1 of A281871.

%K nonn,easy,nice

%O 0,5

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 18:58 EDT 2024. Contains 371781 sequences. (Running on oeis4.)