login
A373779
a(n) is the least prime p such that the digit reversal of n*p is also prime, or -1 if no such prime exists.
2
2, 7, -1, 5, 7, -1, 2, 2, -1, 2, -1, -1, 7, 5, -1, 2, 2, -1, 2, 7, -1, -1, 17, -1, 2, 5, -1, 5, 5, -1, 23, 5, -1, 5, 2, -1, 2, 2, -1, 5, 19, -1, 7, -1, -1, 2, 17, -1, 2, 7, -1, 2, 2, -1, -1, 2, -1, 13, 2, -1, 5, 2, -1, 2, 2, -1, 2, 2, -1, 2, 2, -1, 2, 5, -1, 2, -1, -1, 5, 2, -1, 2, 2, -1, 2, 2
OFFSET
1,1
COMMENTS
a(n) = -1 if n is divisible by 3 or 11.
a(10*n) = a(n).
LINKS
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
Cf. A004086.
Sequence in context: A346253 A351953 A371838 * A215941 A156194 A271855
KEYWORD
sign,base,look
AUTHOR
Robert Israel, Jun 18 2024
STATUS
approved