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.

A102670 Number of digits >= 2 in the decimal representations of all integers from 0 to n.

Original entry on oeis.org

0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 35, 36, 38, 40, 42, 44, 46, 48, 50, 52, 53, 54, 56, 58, 60, 62, 64, 66, 68, 70, 71, 72, 74, 76, 78, 80, 82, 84, 86, 88, 89, 90, 92, 94, 96, 98, 100, 102, 104, 106, 107, 108
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

The total number of digits >= 2 occurring in all the numbers 0, 1, 2, ..., n (in decimal representation). - Hieronymus Fischer, Jun 10 2012

Crossrefs

Programs

  • Maple
    p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=2 then ct:=ct+1 else ct:=ct fi od: ct: end: seq(add(p(i),i=0..n), n=0..77); # Emeric Deutsch, Feb 23 2005
  • Mathematica
    Accumulate[Table[Count[IntegerDigits[n],?(#>1&)],{n,0,80}]] (* _Harvey P. Dale, Apr 17 2014 *)

Formula

From Hieronymus Fischer, Jun 10 2012: (Start)
a(n) = (1/2)*Sum_{j=1..m+1} (floor(n/10^j + 0.8)*(2n + 2 + ((3/5) - floor(n/10^j + 4/5))*10^j) - floor(n/10^j)*(2n + 2 - (1 + floor(n/10^j)) * 10^j)), where m = floor(log_10(n)).
a(n) = (n+1)* A102669(n) + (1/2)*Sum_{j=1..m+1} (((3/5)*floor(n/10^j + 4/5) + floor(n/10^j))*10^j - (floor(n/10^j + 4/5)^2 - floor(n/10^j)^2)*10^j), where m = floor(log_10(n)).
a(10^m - 1) = 8*m*10^(m-1).
(This is the total number of digits >= 2 occurring in all the numbers with <= m places.)
G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (x^(2*10^j) - x^(10*10^j))/(1 - x^10^(j+1)).
General formulas for the total number of digits >= d in the decimal representations of all integers from 0 to n.
a(n) = (1/2)*Sum_{j=1..m+1} (floor(n/10^j + (10-d)/10) *(2n + 2 + ((5-d)/5 - floor(n/10^j + (10-d)/10))*10^j) - floor(n/10^j)*(2n + 2 - (1 + floor(n/10^j)) * 10^j)), where m = floor(log_10(n)).
a(n) = (n+1)*F(n,d) + (1/2)*Sum_{j=1..m+1} ((((5-d)/5)*floor(n/10^j + (10-d)/10) + floor(n/10^j))*10^j - (floor(n/10^j + (10-d)/10)^2 - floor(n/10^j)^2)*10^j), where m = floor(log_10(n)) and F(n,d) = number of digits >= d in the decimal representation of n.
a(10^m - 1) = (10-d)*m*10^(m-1).
(This is the total number of digits >= d occurring in all the numbers with <= m places.)
G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (x^(d*10^j) - x^(10*10^j))/(1 - x^10^(j+1)). (End)

Extensions

More terms from Emeric Deutsch, Feb 23 2005