%I #14 Jan 25 2018 14:10:42
%S 1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,10,4,5,6,7,8,9,10,11,12,13,9,10,
%T 11,12,13,14,15,16,17,18,16,17,18,19,20,21,22,23,24,25,25,26,27,28,29,
%U 30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,49,50,51,52,53,54,55,56,57
%N Let the decimal expansion of n be d_1 d_2 ... d_k; then a(n) = Sum_{i=1..k} d_i^(k+1-i).
%C Every number n (of two or more digits) is guaranteed to yield a smaller number a(n) since 9^k < 10^k This sequence is related to other sequences about sum of the digits or sum of powers of digits.
%e E.g. a(1247) = 1^4 + 2^3 + 4^2 + 7^1 = 1 + 8 + 16 + 7 = 32.
%p A114570 := proc(n) local L; L := convert(n,base,10) ; add( op(i,L)^i,i=1..nops(L)) ; end proc: # _R. J. Mathar_, Dec 20 2010
%t f[n_] := Block[{id = IntegerDigits@ n}, Plus @@ (id^Reverse@ Range@ Length@ id)]; Array[f, 78]
%o (Sage) A114570 = lambda n: sum(d**i for i,d in enumerate(n.digits(), 1)) # _D. S. McNeil_, Dec 21 2010
%o (PARI) a(n) = my(d=digits(n), k=#d); sum(i=1, k, d[i]^(k+1-i)); \\ _Michel Marcus_, Jan 25 2018
%K nonn,base
%O 1,2
%A _Sergio Pimentel_, Feb 16 2006
|