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.

A331112 Sum of the digits of the n-th prime number in balanced ternary.

Original entry on oeis.org

0, 1, -1, 1, 1, 3, -1, 1, -1, 1, 3, 3, -3, -1, -1, -1, -1, 1, 3, -1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, -1, -3, -1, 1, -3, -1, 1, 1, -1, 1, -1, 1, 1, 3, 1, 3, 1, 1, 1, 3, -1, -1, 1, 1, -1, 1, 1, 3, 3, 3, 5, -1, 3, -1, 1, 1, 3, 5, 1, 3, 3, 3, -3, -1, -1, -3, -1, -1, -3, 1, -3, -1, -1, 1, 1, 1, -3, -1, -1, 1, -1, -1, 1, -1, 3, -1, -1, 1, 3, 1
Offset: 1

Views

Author

Thomas König, Jan 09 2020

Keywords

Examples

			Using T for -1 and _bt as suffix for balanced ternary: 2_10 = 1T_bt, sum of digits is zero; 3_10 = 10_bt, sum of digits is 1 and 5_10 = 1TT, sum of digits = -1.
		

Crossrefs

See A007605 (sum of digits of primes in base 10); A239619 (sum of digits of primes in base 3).

Programs

  • C
    #include 
    #include 
    #define N 1000 /* Largest prime considered - 1  */
    char x[N];
    int main()
    {
      int i, n, v, s, r;
      for (i=4; i
    				
  • Maple
    b:= proc(n) `if`(n=0, 0, (d-> `if`(d=2,
          b(q+1)-1, d+b(q)))(irem(n, 3, 'q')))
        end:
    a:= n-> b(ithprime(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Jan 09 2020

Formula

a(n) = A065363(A000040(n)). - Alois P. Heinz, Jan 09 2020