

A262478


a(n) = Sum_{i >= 0} d_i(n) * p_(i + 1) where d_i(n) = ith digit of n in base 3, and p_i = ith prime.


2



0, 2, 4, 3, 5, 7, 6, 8, 10, 5, 7, 9, 8, 10, 12, 11, 13, 15, 10, 12, 14, 13, 15, 17, 16, 18, 20, 7, 9, 11, 10, 12, 14, 13, 15, 17, 12, 14, 16, 15, 17, 19, 18, 20, 22, 17, 19, 21, 20, 22, 24, 23, 25, 27, 14, 16, 18, 17, 19, 21, 20, 22, 24, 19, 21, 23, 22, 24, 26, 25, 27, 29, 24, 26, 28, 27
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

d_i(n) can be found using either of the following formulas:
* d_i(n) = floor(n / 3^i) mod 3;
* d_i(n) = floor(n / 3^i)  3 * floor(n / 3^(i + 1)).


LINKS



FORMULA

a(n) = Sum_{i >= 0} p_(i + 1) * (floor(n / 3^i)  3 * floor(n / 3^(i + 1))).


EXAMPLE

The base 3 representation of n = 5 is 12 so a(5) = 2 * 2 + 1 * 3 = 7.
The base 3 representation of n = 12 is 110 so a(12) = 0 * 2 + 1 * 3 + 1 * 5 = 8.


MATHEMATICA

Table[Sum[IntegerDigits[n, 3][[i]] Prime@ i, {i, IntegerLength[n, 3]}], {n, 0, 81}] (* Michael De Vlieger, Sep 24 2015 *)


PROG

(PARI) a(n) = my(d = Vecrev(digits(n, 3))); sum(k=1, #d, d[k]*prime(k)); \\ Michel Marcus, Sep 24 2015


CROSSREFS

Similar method, different base for n: A089625 (base 2).
Similar method, uses product for sum index for multiplication: A019565 (base 2), A101278 (base 3), A054842 (base 10).


KEYWORD

nonn,base


AUTHOR



STATUS

approved



