login
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
0, 1, 22, 343, 4664, 58985, 713307, 8367637, 96022049
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]
a(n) gives the number of times the digit 7 occurs in all terms of A000027 in the interval [A000027(1), A007908(n)]. - Felix Fröhlich, Oct 28 2016
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
Puzzling Stack Exchange, How many sevens?
M. F. Hasler, Digits d in 0 through 123...n, OEIS Wiki, Nov. 2016.
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
(PARI) A277635(n, m=7)=if(n>m, A277635(n, m+1)+(m+2)*10^(n-m-1), A277830(n)-(m>n)) \\ Valid only for n <= 9. - M. F. Hasler, Nov 02 2016
CROSSREFS
Cf. A277830 - A277838 and A277849: analog for digits 0 .. 9, but based on A014824 instead of A083449.
Sequence in context: A272525 A277849 A277838 * A277837 A277836 A277835
KEYWORD
nonn,base
AUTHOR
STATUS
approved