%I #47 Dec 24 2018 06:13:02
%S 0,2,4,6,8,10,12,14,16,18,3,5,7,9,11,13,15,17,19,21,6,8,10,12,14,16,
%T 18,20,22,24,9,11,13,15,17,19,21,23,25,27,12,14,16,18,20,22,24,26,28,
%U 30,15,17,19,21,23,25,27,29,31,33,18,20,22,24,26,28,30,32,34,36
%N a(n) = Sum_{i >= 1} d_i(n) * prime(i) where d_i(n) is the i-th digit of n in base 10, and prime(i) is the i-th prime.
%C Digits are counted from the right, so d_1(n) is the ones digit, d_2(n) is the tens digit, etc.
%C d_i(n) can be found using either of the following formulas:
%C * d_i(n) = floor(n) / 10^(i-1)) mod 10;
%C * d_i(n) = floor(n / 10^(i-1)) - 10 * floor(n / 10^i).
%C From _Derek Orr_, Dec 24 2015: (Start)
%C For n < 1000, this sequence may be written as a series of 10 X 10 sub-tables:
%C Sub-table 1:
%C 0, 2, 4, 6, 8, 10, 12, 14, 16, 18
%C 3, 5, 7, 9, 11, 13, 15, 17, 19, 21
%C 6, 8, 10, 12, 14, 16, 18, 20, 22, 24
%C 9, 11, 13, 15, 17, 19, 21, 23, 25, 27
%C 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
%C 15, 17, 19, 21, 23, 25, 27, 29, 31, 33
%C 18, 20, 22, 24, 26, 28, 30, 32, 34, 36
%C 21, 23, 25, 27, 29, 31, 33, 35, 37, 39
%C 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
%C 27, 29, 31, 33, 35, 37, 39, 41, 43, 45
%C Sub-table 2:
%C 5, 7, 9, 11, 13, 15, 17, 19, 21, 23
%C 8, 10, 12, 14, 16, 18, 20, 22, 24, 26
%C 11, 13, 15, 17, 19, 21, 23, 25, 27, 29
%C 14, 16, 18, 20, 22, 24, 26, 28, 30, 32
%C 17, 19, 21, 23, 25, 27, 29, 31, 33, 35
%C 20, 22, 24, 26, 28, 30, 32, 34, 36, 38
%C 23, 25, 27, 29, 31, 33, 35, 37, 39, 41
%C 26, 28, 30, 32, 34, 36, 38, 40, 42, 44
%C 29, 31, 33, 35, 37, 39, 41, 43, 45, 47
%C 32, 34, 36, 38, 40, 42, 44, 46, 48, 50
%C Sub-table 3:
%C 10, 12, 14, 16, 18, 20, 22, 24, 26, 28
%C 13, 15, 17, 19, 21, 23, 25, 27, 29, 31
%C 16, 18, 20, 22, 24, 26, 28, 30, 32, 34
%C 19, 21, 23, 25, 27, 29, 31, 33, 35, 37
%C 22, 24, 26, 28, 30, 32, 34, 36, 38, 40
%C 25, 27, 29, 31, 33, 35, 37, 39, 41, 43
%C 28, 30, 32, 34, 36, 38, 40, 42, 44, 46
%C 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
%C 34, 36, 38, 40, 42, 44, 46, 48, 50, 52
%C 37, 39, 41, 43, 45, 47, 49, 51, 53, 55
%C ...
%C Each sub-table is 10 X 10. Let T_n(j,k) = the element in the j-th row of the k-th column of sub-table n. T_n(1,1) = 5*(n-1). T_n(j,1) = 5*(n-1)+3*(j-1). T_n(1,k) = 5*(n-1)+2*(k-1). Altogether, T_n(j,k) = 5*(n-1)+3*(j-1)+2*(k-1) = 5*n+3*j+2*k-10.
%C (End)
%H James Burling, <a href="/A263042/b263042.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = Sum_{i >= 0} prime(i + 1) * (floor(n / 10^i) - 10 * floor(n / 10^(i + 1))).
%e For n = 12, the digits are 2 and 1 and the corresponding primes are 2 and 3, so a(12) = (first digit * first prime) + (second digit * second prime) = 2 * 2 + 1 * 3 = 4 + 3 = 7.
%t Table[Sum_{m=0}^{infinity} (Floor[n/10^(m)] - 10*Floor[n/10^(m+1)])*Prime(m+1), {n,0,500}] (* _G. C. Greubel_, Oct 08 2015 *)
%o (PARI) a(n) = if (n==0, d = [0], d=Vecrev(digits(n))); sum(i=1,#d, d[i]*prime(i)); \\ _Michel Marcus_, Oct 10 2015
%o (PARI) vector(200,n,n--;sum(i=1,#digits(n),Vecrev(digits(n))[i]*prime(i))) \\ _Derek Orr_, Dec 24 2015
%Y Similar method, different base for n: A089625 (base 2), A262478 (base 3).
%Y Similar method, uses product instead of sum: A019565 (base 2), A101278 (base 3), A054842 (base 10).
%K nonn,base,easy
%O 0,2
%A _James Burling_, Oct 08 2015