OFFSET
0,2
COMMENTS
a(0) = 0 might be a more logical value for the initial term. - Antti Karttunen, Sep 28 2018
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..65537
FORMULA
EXAMPLE
a(16)=15 because 10000 is the base-2 representation of n=16 and 11^1 + 7^0 + 5^0 + 3^0 + 2^0 = 15.
MAPLE
A178344 := proc(n)
if n = 0 then
dgs := [0] ;
else
dgs := convert(n, base, 2) ;
end if;
add(ithprime(i)^dgs[i], i=1..nops(dgs)) ;
end proc:
seq(A178344(n), n=0..73) ; # R. J. Mathar, Sep 28 2018
MATHEMATICA
Array[Total@ MapIndexed[Prime[First@ #2]^#1 &, Reverse@ IntegerDigits[#, 2]] &, 74, 0] (* Michael De Vlieger, Feb 19 2019 *)
PROG
(PARI) a(n) = my(b=Vecrev(binary(n))); if (n==0, b=[0]); sum(i=1, #b, prime(i)^b[i]); \\ Michel Marcus, Sep 29 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Juri-Stepan Gerasimov, May 25 2010, Jan 06 2010
EXTENSIONS
Offset modified, keyword:base added by R. J. Mathar, May 28 2010
STATUS
approved