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!)
A004216 a(n) = floor(log_10(n)). 28

%I #44 May 04 2023 02:14:57

%S 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

%T 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

%U 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2

%N a(n) = floor(log_10(n)).

%H Reinhard Zumkeller, <a href="/A004216/b004216.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = if n > 9 then a(floor(n/10)) + 1, else 0. - _Reinhard Zumkeller_, Oct 31 2001

%F a(n) = A055642(n) - 1. - _L. Edson Jeffery_, Jul 09 2014

%F G.f.: (1/(1 - x))*Sum_{k>=1} x^(10^k). - _Ilya Gutkovskiy_, Jan 08 2017

%t Table[ Length[ IntegerDigits[n, 10] ] - 1, {n, 105}] (* _Jean-François Alcover_, Jun 10 2013 *)

%t Table[Floor[Log10[n]], {n, 105}] (* _L. Edson Jeffery_, Jul 09 2014 *)

%o (Haskell)

%o a004216 n = if n <= 9 then 0 else 1 + a004216 (n `div` 10)

%o -- _Reinhard Zumkeller_, Dec 22 2012

%o (PARI) a(n) = logint(n, 10); \\ _Michel Marcus_, Oct 16 2021

%o (Python)

%o def A004216(n): return len(str(n))-1 # _Chai Wah Wu_, May 02 2023

%Y Cf. A055642.

%K nonn,easy

%O 1,100

%A _N. J. A. Sloane_

%E More terms from _James A. Sellers_, Sep 19 2000

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 23 03:30 EDT 2024. Contains 371906 sequences. (Running on oeis4.)