OFFSET
1,2
COMMENTS
Let b(n) = sum( A037904(k),{k=1..n}), then the lim b(n)/n -> 9. Reason, as the number of digits increases, then the likelihood of the maximum digit -> 9 and the minimum digits -> 0 becomes one.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..200
FORMULA
a(n) = 1 + Sum_{w=1..n} Sum_{k=1..9} (10-k)*k*((k+1)^w - 2*k^w + (k-1)^w) - k*((k+1)^(w-1) - k^(w-1)). - Andrew Howroyd, Jan 28 2020
MATHEMATICA
f[n_] := Block[{d = IntegerDigits[n]}, Max[d] - Min[d]]; s = 0; k = 0; Do[ While[k != 10^n, k++; s = s + f[k]]; Print[s], {n, 1, 8}]
PROG
(PARI) a(n)={1 + sum(w=1, n, sum(k=1, 9, (10-k)*k*((k+1)^w - 2*k^w + (k-1)^w) - k*((k+1)^(w-1) - k^(w-1))))} \\ Andrew Howroyd, Jan 28 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Benoit Cloitre and Robert G. Wilson v, Aug 09 2002
EXTENSIONS
a(9)-a(12) from Donovan Johnson, Apr 09 2010
Terms a(13) and beyond from Andrew Howroyd, Jan 28 2020
STATUS
approved