A320909 Numbers k such that k^2 and k^3, when reversed, are prime.
89, 271, 325, 328, 890, 1025, 1055, 1081, 1129, 1169, 1241, 2657, 2710, 3112, 3121, 3149, 3244, 3250, 3263, 3280, 3335, 3346, 3403, 4193, 4222, 4231, 4289, 4291, 5531, 5584, 5653, 5678, 5716, 5791, 5795, 5836, 5837, 8882, 8900, 8926, 8942, 9664, 9794, 9875
Offset: 1
Examples
89 is a term since 89^2 = 7921 and 1297 is prime, and 89^3 = 704969 and 969407 is prime.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000 (first 100 terms from Jesse Endo Jenks)
- Codewars, Square and Cube of a Number Become Prime When Reversed
Programs
-
Mathematica
Select[Range[10^4], AllTrue[IntegerReverse@ {#^2, #^3}, PrimeQ] &] (* Michael De Vlieger, Oct 23 2018 *)
-
PARI
isok(n) = isprime(fromdigits(Vecrev(digits(n^2)))) && isprime(fromdigits(Vecrev(digits(n^3)))); \\ Michel Marcus, Oct 23 2018
-
Python
from sympy import isprime A320909_list = [n for n in range(1,10**6) if isprime(int(str(n**2)[::-1])) and isprime(int(str(n**3)[::-1]))] # Chai Wah Wu, Jan 24 2019