cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A004218 a(n) = log_10(n) rounded up.

This page as a plain text file.
%I A004218 #28 Oct 24 2023 23:15:37
%S A004218 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 A004218 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 A004218 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 A004218 a(n) = log_10(n) rounded up.
%C A004218 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 A004218 Reinhard Zumkeller, <a href="/A004218/b004218.txt">Table of n, a(n) for n = 1..10000</a>
%F A004218 a(1) = 0, a(n) = 1 + A004216(n-1) for n > 1. - _Reinhard Zumkeller_, Dec 22 2012
%F A004218 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 A004218 From _M. F. Hasler_, Dec 07 2018: (Start)
%e A004218 log_10(1) = 0, therefore a(1) = 0.
%e A004218 log_10(2) = 0.301..., therefore a(2) = 1.
%e A004218 log_10(9) = 0.954..., therefore a(9) = 1.
%e A004218 log_10(10) = 1, therefore a(10) = 1.
%e A004218 log_10(11) = 1.04..., therefore a(11) = 2.
%e A004218 log_10(99) = 1.9956..., therefore a(99) = 2.
%e A004218 log_10(100) = 2, therefore a(100) = 2.
%e A004218 log_10(101) = 2.004..., therefore a(101) = 3. (End)
%p A004218 A004218 := proc(n)
%p A004218     ceil(log[10](n)) ;
%p A004218 end proc:
%p A004218 seq(A004218(n),n=1..120) ; # _R. J. Mathar_, May 16 2023
%t A004218 Array[Ceiling[Log10[#]] &, 100] (* _Amiram Eldar_, Dec 08 2018 *)
%o A004218 (Haskell) a004218 n = if n == 1 then 0 else 1 + a004216 (n - 1)
%o A004218 (PARI) A004218(n)=logint(n-(n>1),10)+1 \\ _M. F. Hasler_, Dec 07 2018
%Y A004218 Cf. A004216, A007953, A055642.
%K A004218 nonn
%O A004218 1,11
%A A004218 _N. J. A. Sloane_