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.

A227864 Smallest base in which n's digital reversal is prime, or 0 if no such base exists.

This page as a plain text file.
%I A227864 #23 Jan 15 2023 18:07:13
%S A227864 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,
%T A227864 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,
%U A227864 2,2,3,10,2,6,2,2,3,10,2,26,3,2,27,2,2
%N A227864 Smallest base in which n's digital reversal is prime, or 0 if no such base exists.
%C A227864 0 and 1 are not prime and are single digits in all bases, so no reversal of digits can make them prime. a(n) is therefore 0 for both.
%C A227864 4 is not prime and so cannot be prime if reversed in any base where it is a single digit. This leaves bases 2 and 3 where, upon reversal, it is 1 and 4 respectively. Neither are prime, and so a(4) is also 0.
%C A227864 Conjecture 1: 0, 1 and 4 are the only values where there is no base in which a digital reversal makes a prime.
%C A227864 It is clear that for any prime p, a(p) cannot be zero, since a(p)=p+1 is a solution if there is none smaller.
%C A227864 Conjecture 2: n = 2 is the only prime p which must be represented in base p+1, i.e., trivially, as a single digit, in order for its reversal to be prime.
%C A227864 Corollary: Since a(n) cannot be n itself -- reversing n in base n obtains 1, which is not prime -- this would mean that for all positive n except 2, a(n) < n.
%C A227864 Other than its small magnitude, a(n) = 2 occurs often due to the fact that a reversed positive binary number is guaranteed to be odd and thus stands a greater chance of being prime.
%C A227864 Similarly, many solutions exist solely because reversal removes all powers of the base from n, reducing the number of divisors. Thus based solely on observation:
%C A227864 Conjecture 3: With the restriction gcd(base,n) = 1, a(n) = 0 except for n = 2, 3 and 6k+-1, for positive integer k, i.e., terms of A038179.
%H A227864 Carl R. White, <a href="/A227864/b227864.txt">Table of n, a(n) for n = 0..9999</a>
%e A227864 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.
%o A227864 (Python)
%o A227864 from sympy import isprime
%o A227864 from sympy.ntheory.digits import digits
%o A227864 def okb(n, b):
%o A227864     return isprime(sum(d*b**i for i, d in enumerate(digits(n, b)[1:])))
%o A227864 def a(n):
%o A227864     for b in range(2, n+2):
%o A227864         if okb(n, b): return b
%o A227864     return 0
%o A227864 print([a(n) for n in range(84)]) # _Michael S. Branicky_, Sep 06 2021
%Y A227864 Cf. A114018, A006567, A095179.
%Y A227864 Positions of 2's: A204232.
%K A227864 nonn,base,easy
%O A227864 0,3
%A A227864 _Carl R. White_, Nov 01 2013