A262478 a(n) = Sum_{i >= 0} d_i(n) * p_(i + 1) where d_i(n) = i-th digit of n in base 3, and p_i = i-th prime.
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
Offset: 0
Examples
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.
Links
- James Burling, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Mathematica
Table[Sum[IntegerDigits[n, 3][[-i]] Prime@ i, {i, IntegerLength[n, 3]}], {n, 0, 81}] (* Michael De Vlieger, Sep 24 2015 *)
-
PARI
a(n) = my(d = Vecrev(digits(n, 3))); sum(k=1, #d, d[k]*prime(k)); \\ Michel Marcus, Sep 24 2015
Formula
a(n) = Sum_{i >= 0} p_(i + 1) * (floor(n / 3^i) - 3 * floor(n / 3^(i + 1))).
Comments