login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A055642 Number of digits in decimal expansion of n. 335
1, 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, 3, 3, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,11

COMMENTS

From Hieronymus Fischer, Jun 08 2012: (Start)

For n>0 the first differences of A117804.

The total number of digits necessary to write down all the numbers 0, 1, 2, ... n is given by A117804(n+1). (End)

Here a(0) = 1, but a different common convention is to consider that the expansion of 0 in any base b > 0 has 0 terms and digits. - M. F. Hasler, Dec 07 2018

LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 0..10000

FORMULA

a(A046760(n)) < A050252(A046760(n)); a(A046759(n)) > A050252(A046759(n)). - Reinhard Zumkeller, Jun 21 2011

a(n) = A196563(n) + A196564(n).

a(n) = 1 + floor(log_10(n)) = 1 + A004216(n) = ceiling(log_10(n+1)) = A004218(n+1), if n >= 1. - Daniel Forgues, Mar 27 2014

a(A046758(n)) = A050252(A046758(n)). - Reinhard Zumkeller, Jun 21 2011

a(n) = A117804((n+1) - A117804(n), n>0. - Hieronymus Fischer, Jun 08 2012

G.f.: g(x) = 1 + (1/(1-x))*sum_{j>=0} x^(10^j). - Hieronymus Fischer, Jun 08 2012

a(n) = A262190(n) for n < 100; a(A262198(n)) != A262190(A262198(n)). - Reinhard Zumkeller, Sep 14 2015

EXAMPLE

Examples:

999: 1 + floor(log_10(999)) = 1 + floor(2.x) = 1 + 2 = 3 or

      ceiling(log_10(999+1)) = ceiling(log_10(1000)) = ceiling(3) = 3;

1000: 1 + floor(log_10(1000)) = 1 + floor(3) = 1 + 3 = 4 or

      ceiling(log_10(1000+1)) = ceiling(log_10(1001)) = ceiling(3.x) = 4;

1001: 1 + floor(log_10(1001)) = 1 + floor(3.x) = 1 + 3 = 4 or

      ceiling(log_10(1001+1)) = ceiling(log_10(1002)) = ceiling(3.x) = 4;

MAPLE

A055642 := proc(n)

        max(1, ilog10(n)+1) ;

end proc:  # R. J. Mathar, Nov 30 2011

MATHEMATICA

Join[{1}, Array[ Floor[ Log[10, 10# ]] &, 104]] (* Robert G. Wilson v, Jan 04 2006 *)

Join[{1}, Table[IntegerLength[n], {n, 104}]]

IntegerLength[Range[0, 120]] (* Harvey P. Dale, Jul 02 2016 *)

PROG

(PARI) a(n)=#Str(n) \\ M. F. Hasler, Nov 17 2008

(PARI) A055642(n)=logint(n+!n, 10)+1 \\ Increasingly faster than the above, for larger n. (About twice as fast for n ~ 10^7.) - M. F. Hasler, Dec 07 2018

(Haskell)

a055642 :: Integer -> Int

a055642 = length . show  -- Reinhard Zumkeller, Feb 19 2012, Apr 26 2011

(MAGMA) [ #Intseq(n): n in [0..105] ];   //  Bruno Berselli, Jun 30 2011

(Common Lisp) (defun A055642 (n) (if (zerop n) 1 (floor (log n 10)))) ; James Spahlinger, Oct 13 2012

CROSSREFS

Cf. A043537, A178788, A046034, A019546, A054899, A122840, A055640, A055641, A102669-A102685, A117804, A160093, A160094, A196563, A196564, A000120, A000788, A023416, A059015 (for base 2).

Cf. A262190, A262198.

Cf. A007953: sum of digits.

Sequence in context: A040000 A239374 A262190 * A276502 A138902 A211668

Adjacent sequences:  A055639 A055640 A055641 * A055643 A055644 A055645

KEYWORD

base,easy,nonn,nice

AUTHOR

Henry Bottomley, Jun 06 2000

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 23:02 EDT 2019. Contains 321343 sequences. (Running on oeis4.)