A065039 If n in base 10 is d_1 d_2 ... d_k then a(n) = d_1 + d_1d_2 + d_1d_2d_3 + ... + d_1...d_k.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70
Offset: 0
Examples
a(1234)=1370 because 1+12+123+1234=1370. With repunits: a(1234) = 4*1 + 3*11 + 2*111 + 1*1111 = 1370. - _Wolfdieter Lang_, May 04 2010
References
- M. Gardner, Mathematische Zaubereien, Dumont, 2004, p. 39. German translation of: Mathematics, Magic and Mystery, Dover, 1956. [From Wolfdieter Lang, May 04 2010]
Links
- Harry J. Smith, Table of n, a(n) for n = 0..1000
Crossrefs
Programs
-
Haskell
import Data.List (inits) a065039 n = sum $ map read $ tail $ inits $ show n -- Reinhard Zumkeller, Mar 31 2011
-
Maple
A065039 := proc(n) local d,m: d:=convert(n,base,10): m:=nops(d): return add(op(convert(d[(m-k+1)..m], base, 10, 10^m)),k=1..m): end: seq(A065039(n),n=0..64); # Nathaniel Johnston, Jun 27 2011
-
Mathematica
a[n_] := Apply[Plus, Table[FromDigits[Take[IntegerDigits[n], k]], {k, 1, Length[IntegerDigits[n]]}]] Table[d = IntegerDigits[n]; rd = 0; While[ Length[d] > 0, rd = rd + FromDigits[d]; d = Drop[d, -1]]; rd, {n, 0, 75} ] f[n_] := Plus @@ NestList[ Quotient[ #, 10] &, n, Max[1, Floor@ Log[10, n]]]; Array[f, 70, 0] (* Robert G. Wilson v, Jun 29 2010 *) Array[Total[Table[FromDigits[Take[IntegerDigits[#],x]],{x, IntegerLength[ #]}]]&,100,0](* Harvey P. Dale, Jan 02 2016 *)
-
PARI
{ for (n=0, 1000, a=0; k=n; until (k==0, a+=k; k\=10); write("b065039.txt", n, " ", a) ) } \\ Harry J. Smith, Oct 04 2009
Formula
a(n) = sum( k>=0, floor(n/10^ k)) = n+A054899(n). - Benoit Cloitre, Aug 03 2002
From Hieronymus Fischer, Aug 14 2007: (Start)
a(10*n)=10*n+a(n); a(n*10^m)=10*n*(10^m-1)/9+a(n).
a(k*10^m)=k*(10^(m+1)-1)/2, 0<=k<10, m>=0.
a(n)=10/9*n+O(log(n)), a(n+1)-a(n)=O(log(n)); this follows from the inequalities below.
a(n)<=(10*n-1)/9; equality holds for powers of 10.
a(n)>=(10*n-9)/9-floor(log_10(n)); equality holds for n=10^m-1, m>0.
lim inf (10*n/9-a(n))=1/9, for n-->oo.
lim sup (10*n/9-log_10(n)-a(n))=0, for n-->oo.
lim sup (a(n+1)-a(n)-log_10(n))=1, for n-->oo.
G.f.: sum{k>=0, x^(10^k)/(1-x^(10^k))}/(1-x).
(End)
a(n) = sum(d_(k)*RU(k+1),k=0..nod(n)-1), with the notation nod(n)and d_k given in a comment above, and RU(k)is the repunit (10^k-1)/9 (k times 1). - Wolfdieter Lang, May 04 2010
Comments