OFFSET
1,1
FORMULA
Let b(n) = sum( A037904(k), {k=1..n}), a(n) = |2*b(n) - 9*n|.
MATHEMATICA
f[n_] := Block[{d = IntegerDigits[n]}, Max[d] - Min[d]]; b[n_] := b[n] = b[n - 1] + f[n]; b[1] = 0; a[n_] := a[n] = Abs[2b[n] - 9*n]; Table[ a[n], {n, 1, 65}]
gdmld[n_]:=Module[{idn=IntegerDigits[n]}, Max[idn]-Min[idn]]; Module[ {nn=60, gd}, gd=Accumulate[gdmld/@Range[nn]]; Abs[ 2*Last[#]- 9*First[ #]]&/@Thread[{Range[nn], gd}]]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Benoit Cloitre and Robert G. Wilson v, Aug 09 2002
EXTENSIONS
Definition clarified by Harvey P. Dale, May 21 2014
STATUS
approved