OFFSET
4,1
COMMENTS
Conjecture: a(n) = -1 only for n = 11.
LINKS
Robert Israel, Table of n, a(n) for n = 4..10000
EXAMPLE
a(15) = 2 because 2 is prime and 15 - 2 = 13 is the reverse of the prime 31.
MAPLE
rev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
P:= select(isprime, [2, seq(i, i=3..1000, 2)]):
revP:= sort(map(rev, P)):
nP:= nops(P):
V:= Vector(1000, -1):
for i from 1 to nP do
for j from 1 to nP while P[i]+revP[j] <= 1000 do
v:= P[i]+revP[j]; if V[v]=-1 then V[v]:= P[i] fi
od od:
convert(V[4..1000], list);
PROG
(Python)
from sympy import isprime
def a393460(n):
for p in range(2, n):
if isprime(p):
diff = n - p
if diff % 10 == 0:
continue
if isprime(int(str(diff)[::-1])):
return p
return -1
seq = [a393460(n) for n in range(4, 91)]
print(seq) # Aitzaz Imtiaz, Feb 20 2026
(PARI) a(n) = forprime(p=2, n, my(x=Vecrev(digits(n-p))); if (#x && x[1] && isprime(fromdigits(x)), return(p))); -1; \\ Michel Marcus, Feb 21 2026
CROSSREFS
KEYWORD
AUTHOR
Robert Israel, Feb 15 2026
EXTENSIONS
Name edited by Michel Marcus, Feb 21 2026
STATUS
approved
