|
|
A277635
|
|
Number of 7's appearing in the sequence of consecutive natural numbers from 1 to A007908(n), where A007908 = (1, 12, 123, 1234, ...).
|
|
11
|
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
First 6 terms are the same as in A083449, also see A272525. [See the OEIS wiki page for more details. - M. F. Hasler, Dec 29 2020]
The sequence was initially defined only up to n = 9 and then extended using A007908 = concat(1..n); see A277837 for the extension using A014824 (a(n) = 10 a(n-1) + n) leading to a smoother growth, in particular at powers of 10. - M. F. Hasler, Nov 01 2016, edited Dec 29 2020
|
|
LINKS
|
|
|
EXAMPLE
|
22 is the third term of the sequence because there are 22 occurrences of the digit '7' contained in numbers within the range of 1 to 123.
96022049 is the 9th term of the sequence because there are 96022049 occurrences of the digit '7' contained in numbers within the range of 1 to 123456789.
|
|
MATHEMATICA
|
Table[a[n] = Count[Flatten@ Map[IntegerDigits, Range@ FromDigits@ Range@ n], k_ /; k == 8]; Print@ a@ n; an = a[n]; an, {n, 0, 9}] (* Michael De Vlieger, Oct 30 2016 *)
|
|
PROG
|
(PARI) print1(c=0); N=1; for(n=2, 8, print1(", "c+=sum(k=N+1, N=eval(Str(N, n)), #select(d->d==7, digits(k))))) \\ For illustration; more efficient code below. - M. F. Hasler, Oct 31 2016
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|