cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

James Burling, Sep 23 2015

Keywords

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)).

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.
		

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).

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))).