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

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A058183 Number of digits in concatenation of first n positive integers. 14
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Or, total number of digits in numbers from 1 through n.

a(n) = A055642(A053064(n)). - Reinhard Zumkeller, Oct 10 2008

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..10000

GeeksforGeeks,  Count total number of digits from 1 to n

Eric Weisstein's World of Mathematics, Smarandache Number

FORMULA

a(n) = (n+1)*floor[log10(10n)]-(10^floor[log10(10n)]-1)/(10-1) = a(n-1)+floor[log10(10n)] = A055642(A007908(n)).

a(n) ~ n log_10 n + O(n). In particular lim inf (n log_10 n - a(n))/n = (1+log(10/9)+log(log(10)))/log(10) and the corresponding lim sup is 10/9. - Charles R Greathouse IV, Sep 19 2012

G.f.: (1-x)^(-2)*Sum_{j>=0} x^(10^j). - Robert Israel, Nov 04 2015

EXAMPLE

a(12) = 15 since 123456789101112 has 15 digits.

MAPLE

a:= proc(n) a(n):= `if`(n=0, 0, a(n-1) +length(n)) end:

seq(a(n), n=1..100);  # Alois P. Heinz, Nov 26 2013

MATHEMATICA

IntegerLength /@ FoldList[#2 + #1 10^IntegerLength[#2] &, Range[50]] (* Eric W. Weisstein, Nov 06 2015 *)

Table[With[{d = Floor[Log10[n]] + 1}, (n + 1) d - (10^d - 1)/9], {n, 50}] (* Eric W. Weisstein, Nov 04 2015 *)

Table[With[{d = IntegerLength[n]}, (n + 1) d - (10^d - 1)/9], {n, 50}] (* Eric W. Weisstein, Nov 06 2015 *)

Length /@ Flatten /@ IntegerDigits /@ Flatten /@ Rest[FoldList[List, {}, Range[20]]] (* Eric W. Weisstein, Nov 04 2015 *)

Accumulate[ IntegerLength@ # & /@ Range @ 70] (* Robert G. Wilson v, Jul 31 2018 *)

PROG

(PARI) a(n)=my(t=log(10*n+.5)\log(10)); n*t+t-10^t\9 \\ Charles R Greathouse IV, Sep 19 2012

(PARI) a(n) = sum(k=1, n, #digits(k)); \\ Michel Marcus, Jan 01 2017

CROSSREFS

Sequence in context: A298297 A225580 A071980 * A322341 A080676 A033061

Adjacent sequences:  A058180 A058181 A058182 * A058184 A058185 A058186

KEYWORD

base,easy,nonn

AUTHOR

Henry Bottomley, Nov 17 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 January 19 09:35 EST 2019. Contains 319306 sequences. (Running on oeis4.)