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.
%I A065039 #32 Jul 18 2019 17:37:21 %S A065039 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, %T A065039 28,29,30,31,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52, %U A065039 53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70 %N 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. %C A065039 a(n) = (D(n) - sod(n))/9, for n >= 1, with sod(n) the sum of digits of n, and with D(n) any of the 10 numbers given in base 10 representation by d_(nod(n)-1) d_(nod(n)-2) ... d_0 b_0, where nod(n) is the number of digits of n = d_(nod(n)-1) d_(nod(n)-2) ... d_0 in base 10, and b_0 from {0, 1, ..., 9}. E.g., D(1234) stands for any number from {12340, 12341, ..., 12349}. This corresponds the well known (and easy to prove) rule that any number after subtraction of its sum of digits is divisible by 9. In this subtraction any of the last digit b_0 leads to the same result. Some mathematical tricks are based on this rule. See the Gardner reference. - _Wolfdieter Lang_, May 04 2010 %D A065039 M. Gardner, Mathematische Zaubereien, Dumont, 2004, p. 39. German translation of: Mathematics, Magic and Mystery, Dover, 1956. [From _Wolfdieter Lang_, May 04 2010] %H A065039 Harry J. Smith, <a href="/A065039/b065039.txt">Table of n, a(n) for n = 0..1000</a> %F A065039 a(n) = sum( k>=0, floor(n/10^ k)) = n+A054899(n). - _Benoit Cloitre_, Aug 03 2002 %F A065039 From _Hieronymus Fischer_, Aug 14 2007: (Start) %F A065039 a(10*n)=10*n+a(n); a(n*10^m)=10*n*(10^m-1)/9+a(n). %F A065039 a(k*10^m)=k*(10^(m+1)-1)/2, 0<=k<10, m>=0. %F A065039 a(n)=10/9*n+O(log(n)), a(n+1)-a(n)=O(log(n)); this follows from the inequalities below. %F A065039 a(n)<=(10*n-1)/9; equality holds for powers of 10. %F A065039 a(n)>=(10*n-9)/9-floor(log_10(n)); equality holds for n=10^m-1, m>0. %F A065039 lim inf (10*n/9-a(n))=1/9, for n-->oo. %F A065039 lim sup (10*n/9-log_10(n)-a(n))=0, for n-->oo. %F A065039 lim sup (a(n+1)-a(n)-log_10(n))=1, for n-->oo. %F A065039 G.f.: sum{k>=0, x^(10^k)/(1-x^(10^k))}/(1-x). %F A065039 (End) %F A065039 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 %e A065039 a(1234)=1370 because 1+12+123+1234=1370. %e A065039 With repunits: a(1234) = 4*1 + 3*11 + 2*111 + 1*1111 = 1370. - _Wolfdieter Lang_, May 04 2010 %p A065039 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 %t A065039 a[n_] := Apply[Plus, Table[FromDigits[Take[IntegerDigits[n], k]], {k, 1, Length[IntegerDigits[n]]}]] %t A065039 Table[d = IntegerDigits[n]; rd = 0; While[ Length[d] > 0, rd = rd + FromDigits[d]; d = Drop[d, -1]]; rd, {n, 0, 75} ] %t A065039 f[n_] := Plus @@ NestList[ Quotient[ #, 10] &, n, Max[1, Floor@ Log[10, n]]]; Array[f, 70, 0] (* _Robert G. Wilson v_, Jun 29 2010 *) %t A065039 Array[Total[Table[FromDigits[Take[IntegerDigits[#],x]],{x, IntegerLength[ #]}]]&,100,0](* _Harvey P. Dale_, Jan 02 2016 *) %o A065039 (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 %o A065039 (Haskell) %o A065039 import Data.List (inits) %o A065039 a065039 n = sum $ map read $ tail $ inits $ show n %o A065039 -- _Reinhard Zumkeller_, Mar 31 2011 %Y A065039 Complement of A065438. %Y A065039 Cf. A067079, A067080, A067082, A054899, A054861, A067080, A098844, A132027, A005187. %K A065039 nonn,base,easy,nice %O A065039 0,3 %A A065039 _Santi Spadaro_, Nov 04 2001