A227864 Smallest base in which n's digital reversal is prime, or 0 if no such base exists.
0, 0, 3, 2, 0, 2, 2, 2, 4, 6, 2, 2, 2, 2, 2, 3, 8, 2, 3, 3, 2, 3, 2, 2, 2, 2, 2, 9, 2, 2, 6, 2, 4, 3, 2, 3, 12, 2, 6, 3, 2, 2, 6, 2, 2, 3, 2, 2, 2, 3, 2, 9, 2, 2, 3, 2, 2, 3, 2, 4, 12, 2, 2, 3, 12, 3, 6, 2, 2, 3, 10, 2, 6, 2, 2, 3, 10, 2, 26, 3, 2, 27, 2, 2
Offset: 0
Examples
9 in base 2 is 1001, which when reversed is the same and so not prime. In base 3 it is 100, which becomes 1 when reversed and also not prime. Base 4: 21 -> 12 (6 decimal), not prime; Base 5: 14 -> 41 (21 decimal), not prime; Base 6: 13 -> 31 (19 decimal), which is prime, so a(9) = 6, i.e., 6 is the smallest base in which 9's digital reversal is a prime number.
Links
- Carl R. White, Table of n, a(n) for n = 0..9999
Programs
-
Python
from sympy import isprime from sympy.ntheory.digits import digits def okb(n, b): return isprime(sum(d*b**i for i, d in enumerate(digits(n, b)[1:]))) def a(n): for b in range(2, n+2): if okb(n, b): return b return 0 print([a(n) for n in range(84)]) # Michael S. Branicky, Sep 06 2021
Comments