OFFSET
1,1
COMMENTS
The base-b expansion (d_1)(d_2)...(d_m) of a number is antipalindromic if, for each of its m digits, it holds that d_k + d_{m-k+1} = b-1.
In a base other than 3, there is at most a single antipalindromic prime.
LINKS
Lubomira Dvorakova, Stanislav Kruml, and David Ryzák, Antipalindromic numbers, arXiv:2008.06864 [math.CO], 2020.
EXAMPLE
For m = 3, the only solution is 13 = 111_3.
For m = 5, the only solution is 97 = 10121_3.
MATHEMATICA
Select[Prime[Range[52000]], FromDigits[Reverse[2 - IntegerDigits[#, 3]], 3] == # &] (* Amiram Eldar, Jun 16 2024 *)
PROG
(Python)
from sympy import isprime
from itertools import count, islice, product
def bgen(): # generator of terms of A284798
yield 1
for d in count(2):
for first in [1, 2]:
for rest in product([0, 1, 2], repeat=(d-2)//2):
left, mid = (first, ) + rest, (1, ) if d&1 else tuple()
right = tuple([2-d for d in left][::-1])
yield int("".join(str(d) for d in left + mid + right), 3)
def agen(): yield from filter(isprime, bgen())
print(list(islice(agen(), 40))) # Michael S. Branicky, Jun 16 2024
CROSSREFS
KEYWORD
base,nonn,easy
AUTHOR
Stanislav Kruml, May 12 2024
STATUS
approved