login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A167216
Primes whose reversal - 1 is also prime.
3
3, 23, 41, 47, 83, 89, 233, 251, 257, 281, 401, 461, 491, 809, 821, 827, 839, 857, 863, 887, 2003, 2069, 2081, 2099, 2153, 2213, 2237, 2267, 2333, 2351, 2381, 2393, 2399, 2477, 2591, 2633, 2657, 2711, 2741, 2753, 2789, 2819, 2879, 2909, 2939, 2957, 2963
OFFSET
1,1
LINKS
EXAMPLE
23 is in the sequence because 23 is prime and 32 - 1 = 31 is prime.
MAPLE
reverse:= proc(n)
local L, j;
L:= convert(n, base, 10);
add(L[j]*10^(nops(L)-j), j=1..nops(L))
end proc:
select(n -> isprime(n) and isprime(reverse(n)-1), [$1..10000]); # Robert Israel, Jul 11 2014
MATHEMATICA
Select[Prime[Range[5000]], PrimeQ[FromDigits[Reverse[IntegerDigits[#]]] - 1] &] (* Vincenzo Librandi, Jul 11 2014 *)
PROG
(Magma) [p: p in PrimesInInterval(2, 3000) | IsPrime(q-1) where q is Seqint(Reverse(Intseq(p)))]; // Vincenzo Librandi, Jul 11 2014
(Python)
from sympy import isprime, primerange
def ok(p): return isprime(int(str(p)[::-1]) - 1)
print([p for p in primerange(1, 3000) if ok(p)]) # Michael S. Branicky, Mar 23 2021
(PARI) isok(p) = isprime(p) && isprime(fromdigits(Vecrev(digits(p)))-1); \\ Michel Marcus, Mar 23 2021
CROSSREFS
Cf. similar sequences listed in A243457.
Sequence in context: A116893 A106066 A281551 * A309935 A212396 A319976
KEYWORD
nonn,base
AUTHOR
Claudio Meller, Oct 30 2009
EXTENSIONS
Comment changed to an Example by Robert Israel, Jul 11 2014
STATUS
approved