A161721 Primes p such that the reversal of p is prime and the product of p with its reversal is a palindrome.
2, 3, 11, 101, 1021, 1201, 111211, 112111, 1000211, 1010201, 1020101, 1101211, 1102111, 1111021, 1112011, 1120001, 1121011, 1201111, 10011101, 10012001, 10021001, 10100201, 10111001, 10200101, 11012011, 11021011, 11100121, 12100111
Offset: 1
Examples
1021 is a prime number, its reversal is 1201, which is also a prime. The product 1021*1201 = 1226221 is a palindrome.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..1255 (first 97 terms from Chai Wah Wu)
- Tanya Khovanova, Turning Numbers Inside Out
Programs
-
Maple
rev := proc (n) local nn: nn := convert(n, base, 10): add(nn[j]*10^(nops(nn)-j), j = 1 .. nops(nn)) end proc: a := proc (n) local p: p := ithprime(n): if isprime(rev(p)) = true and rev(p*rev(p)) = p*rev(p) then p else end if end proc: seq(a(n), n = 1 .. 800000); # Emeric Deutsch, Jun 26 2009
-
Mathematica
rev[n_]:=FromDigits[Reverse[IntegerDigits[n]]]; t={}; Do[p=Prime[n]; If[PrimeQ[q=rev[p]] && rev[p*q]==p*q, AppendTo[t,p]], {n,8*10^5}]; t (* Jayanta Basu, May 11 2013 *)
-
Python
from sympy import isprime A161721_list = [2] for i in range(3,10**6,2): j = int(str(i)[::-1]) if j == i: s = str(i**2) if s == s[::-1] and isprime(i): A161721_list.append(i) elif j > i: s = str(i*j) if s == s[::-1] and isprime(i) and isprime(j): A161721_list.extend([i,j]) A161721_list = sorted(A161721_list) # Chai Wah Wu, Jan 07 2015
Extensions
Edited by N. J. A. Sloane, Jun 23 2009
More terms from Emeric Deutsch, Jun 26 2009
Comments