login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 2

%I #21 Oct 02 2015 12:02:08

%S 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,

%T 7,9,11,10,12,14,13,15,17,12,14,16,15,17,19,18,20,22,17,19,21,20,22,

%U 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

%N 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.

%C d_i(n) can be found using either of the following formulas:

%C * d_i(n) = floor(n / 3^i) mod 3;

%C * d_i(n) = floor(n / 3^i) - 3 * floor(n / 3^(i + 1)).

%H James Burling, <a href="/A262478/b262478.txt">Table of n, a(n) for n = 0..10000</a>

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

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

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

%t Table[Sum[IntegerDigits[n, 3][[-i]] Prime@ i, {i, IntegerLength[n, 3]}], {n, 0, 81}] (* _Michael De Vlieger_, Sep 24 2015 *)

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

%Y Similar method, different base for n: A089625 (base 2).

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

%K nonn,base

%O 0,2

%A _James Burling_, Sep 23 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 13 11:59 EDT 2024. Contains 375907 sequences. (Running on oeis4.)