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!)
A004218 a(n) = log_10(n) rounded up. 10

%I #28 Oct 24 2023 23:15:37

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

%T 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,

%U 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3

%N a(n) = log_10(n) rounded up.

%C a(n) is the number of terms in the sequence A011557 (Powers of 10) that are less than n. For n > 1, a(n) is the number of digits in n-1. - _Tanya Khovanova_, Jun 22 2007

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

%F a(1) = 0, a(n) = 1 + A004216(n-1) for n > 1. - _Reinhard Zumkeller_, Dec 22 2012

%F a(n) = A055642(n-1) for all n > 1. a(n+1) is the number of decimal digits of n if 0 is considered to have 0 digits. - _M. F. Hasler_, Dec 07 2018

%e From _M. F. Hasler_, Dec 07 2018: (Start)

%e log_10(1) = 0, therefore a(1) = 0.

%e log_10(2) = 0.301..., therefore a(2) = 1.

%e log_10(9) = 0.954..., therefore a(9) = 1.

%e log_10(10) = 1, therefore a(10) = 1.

%e log_10(11) = 1.04..., therefore a(11) = 2.

%e log_10(99) = 1.9956..., therefore a(99) = 2.

%e log_10(100) = 2, therefore a(100) = 2.

%e log_10(101) = 2.004..., therefore a(101) = 3. (End)

%p A004218 := proc(n)

%p ceil(log[10](n)) ;

%p end proc:

%p seq(A004218(n),n=1..120) ; # _R. J. Mathar_, May 16 2023

%t Array[Ceiling[Log10[#]] &, 100] (* _Amiram Eldar_, Dec 08 2018 *)

%o (Haskell) a004218 n = if n == 1 then 0 else 1 + a004216 (n - 1)

%o (PARI) A004218(n)=logint(n-(n>1),10)+1 \\ _M. F. Hasler_, Dec 07 2018

%Y Cf. A004216, A007953, A055642.

%K nonn

%O 1,11

%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 25 08:27 EDT 2024. Contains 371964 sequences. (Running on oeis4.)