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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Comments

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

Examples

			From _M. F. Hasler_, Dec 07 2018: (Start)
log_10(1) = 0, therefore a(1) = 0.
log_10(2) = 0.301..., therefore a(2) = 1.
log_10(9) = 0.954..., therefore a(9) = 1.
log_10(10) = 1, therefore a(10) = 1.
log_10(11) = 1.04..., therefore a(11) = 2.
log_10(99) = 1.9956..., therefore a(99) = 2.
log_10(100) = 2, therefore a(100) = 2.
log_10(101) = 2.004..., therefore a(101) = 3. (End)
		

Crossrefs

Programs

  • Haskell
    a004218 n = if n == 1 then 0 else 1 + a004216 (n - 1)
    
  • Maple
    A004218 := proc(n)
        ceil(log[10](n)) ;
    end proc:
    seq(A004218(n),n=1..120) ; # R. J. Mathar, May 16 2023
  • Mathematica
    Array[Ceiling[Log10[#]] &, 100] (* Amiram Eldar, Dec 08 2018 *)
  • PARI
    A004218(n)=logint(n-(n>1),10)+1 \\ M. F. Hasler, Dec 07 2018

Formula

a(1) = 0, a(n) = 1 + A004216(n-1) for n > 1. - Reinhard Zumkeller, Dec 22 2012
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