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.

Showing 1-1 of 1 results.

A263042 a(n) = Sum_{i >= 1} d_i(n) * prime(i) where d_i(n) is the i-th digit of n in base 10, and prime(i) is the i-th prime.

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36
Offset: 0

Views

Author

James Burling, Oct 08 2015

Keywords

Comments

Digits are counted from the right, so d_1(n) is the ones digit, d_2(n) is the tens digit, etc.
d_i(n) can be found using either of the following formulas:
* d_i(n) = floor(n / 10^(i-1)) mod 10;
* d_i(n) = floor(n / 10^(i-1)) - 10 * floor(n / 10^i).
From Derek Orr, Dec 24 2015: (Start)
For n < 1000, this sequence may be written as a series of 10 X 10 subtables:
Subtable 1:
0, 2, 4, 6, 8, 10, 12, 14, 16, 18
3, 5, 7, 9, 11, 13, 15, 17, 19, 21
6, 8, 10, 12, 14, 16, 18, 20, 22, 24
9, 11, 13, 15, 17, 19, 21, 23, 25, 27
12, 14, 16, 18, 20, 22, 24, 26, 28, 30
15, 17, 19, 21, 23, 25, 27, 29, 31, 33
18, 20, 22, 24, 26, 28, 30, 32, 34, 36
21, 23, 25, 27, 29, 31, 33, 35, 37, 39
24, 26, 28, 30, 32, 34, 36, 38, 40, 42
27, 29, 31, 33, 35, 37, 39, 41, 43, 45
Subtable 2:
5, 7, 9, 11, 13, 15, 17, 19, 21, 23
8, 10, 12, 14, 16, 18, 20, 22, 24, 26
11, 13, 15, 17, 19, 21, 23, 25, 27, 29
14, 16, 18, 20, 22, 24, 26, 28, 30, 32
17, 19, 21, 23, 25, 27, 29, 31, 33, 35
20, 22, 24, 26, 28, 30, 32, 34, 36, 38
23, 25, 27, 29, 31, 33, 35, 37, 39, 41
26, 28, 30, 32, 34, 36, 38, 40, 42, 44
29, 31, 33, 35, 37, 39, 41, 43, 45, 47
32, 34, 36, 38, 40, 42, 44, 46, 48, 50
Subtable 3:
10, 12, 14, 16, 18, 20, 22, 24, 26, 28
13, 15, 17, 19, 21, 23, 25, 27, 29, 31
16, 18, 20, 22, 24, 26, 28, 30, 32, 34
19, 21, 23, 25, 27, 29, 31, 33, 35, 37
22, 24, 26, 28, 30, 32, 34, 36, 38, 40
25, 27, 29, 31, 33, 35, 37, 39, 41, 43
28, 30, 32, 34, 36, 38, 40, 42, 44, 46
31, 33, 35, 37, 39, 41, 43, 45, 47, 49
34, 36, 38, 40, 42, 44, 46, 48, 50, 52
37, 39, 41, 43, 45, 47, 49, 51, 53, 55
...
Each subtable is 10 X 10. Let T_n(j,k) = the element in the j-th row of the k-th column of subtable n. T_n(1,1) = 5*(n-1). T_n(j,1) = 5*(n-1)+3*(j-1). T_n(1,k) = 5*(n-1)+2*(k-1). Altogether, T_n(j,k) = 5*(n-1)+3*(j-1)+2*(k-1) = 5*n+3*j+2*k-10.
(End)

Examples

			For n = 12, the digits are 2 and 1 and the corresponding primes are 2 and 3, so a(12) = (first digit * first prime) + (second digit * second prime) = 2 * 2 + 1 * 3 = 4 + 3 = 7.
		

Crossrefs

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

Programs

  • Mathematica
    Table[Sum_{m=0}^{infinity} (Floor[n/10^(m)] - 10*Floor[n/10^(m+1)])*Prime(m+1), {n,0,500}] (* G. C. Greubel, Oct 08 2015 *)
  • PARI
    a(n) = if (n==0, d = [0], d=Vecrev(digits(n))); sum(i=1,#d, d[i]*prime(i)); \\ Michel Marcus, Oct 10 2015
    
  • PARI
    vector(200,n,n--;sum(i=1,#digits(n),Vecrev(digits(n))[i]*prime(i))) \\ Derek Orr, Dec 24 2015

Formula

a(n) = Sum_{i >= 0} prime(i + 1) * (floor(n / 10^i) - 10 * floor(n / 10^(i + 1))).
Showing 1-1 of 1 results.