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.

A355034 a(n) is the least base b >= 2 where the sum of digits of n is a prime number.

Original entry on oeis.org

3, 2, 3, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 3, 8, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 5, 2, 3, 3, 2, 4, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 4, 2, 2, 2, 2, 3, 2, 3, 3, 2, 2, 3, 4, 2, 6, 2, 2, 3, 18, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 6, 2, 2, 2, 2, 3, 2, 3, 4, 2, 2
Offset: 2

Views

Author

Rémy Sigrist, Jun 16 2022

Keywords

Comments

The sequence is well defined:
- a(2) = 3,
- for n >= 3, the expansion of n in base n-1 is "11", with sum of digits 2.

Examples

			For n = 16:
- we have the following expansions and sum of digits:
     b  16_b     Sum of digits in base b
     -  -------  -----------------------
     2  "10000"                        1
     3    "121"                        4
     4    "100"                        1
     5     "31"                        4
     6     "24"                        6
     7     "22"                        4
     8     "20"                        2
- so a(16) = 8.
		

Crossrefs

Cf. A052294, A216789, A355035 (corresponding prime numbers).

Programs

  • PARI
    a(n) = for (b=2, oo, if (isprime(sumdigits(n,b)), return (b)))
    
  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def a(n):
        b = 2
        while not isprime(sum(digits(n, b)[1:])): b += 1
        return b
    print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Jun 16 2022

Formula

a(n) = 2 iff n belongs to A052294.
a(n) <= n-1 for any n >= 3.
Showing 1-1 of 1 results.