OFFSET
1,1
COMMENTS
a(n) = -1 if n is divisible by 3 or 11.
a(10*n) = a(n).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = 7 because 7 is prime and the reversal of 5 * 7 = 35 is 53 which is prime, while the reversals of 5 * 2 = 10, 5 * 3 = 15 and 5 * 5 = 25 are not prime.
MAPLE
rev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
f:= proc(n) local p;
if n mod 3 = 0 or n mod 11 = 0 then return -1 fi;
p:= 1:
do
p:= nextprime(p);
if isprime(rev(n*p)) then return p fi
od;
end proc:
map(f, [$1..100]);
MATHEMATICA
A373779[n_] := If[Divisible[n, 3] || Divisible[n, 11], -1, Block[{i = 0}, While[!PrimeQ[IntegerReverse[n*Prime[++i]]]]; Prime[i]]];
Array[A373779, 100] (* Paolo Xausa, Jun 24 2024 *)
CROSSREFS
KEYWORD
AUTHOR
Robert Israel, Jun 18 2024
STATUS
approved