login
Primes p such that the reversal of p^2 is the square of a prime.
1

%I #17 Apr 08 2026 00:17:59

%S 2,3,11,13,31,101,113,307,311,1021,1031,1103,1201,1301,3011,11003,

%T 30011,110221,111211,112111,122011,1000211,1001003,1010201,1020101,

%U 1100311,1101103,1101211,1102111,1111021,1112011,1120001,1121011,1130011,1201111,3001001,3011011,10002121,10011101,10012001

%N Primes p such that the reversal of p^2 is the square of a prime.

%C The first two terms that are not in A085306 are a(8) = 307 and a(55) = 30001253.

%C The first two terms p such that the square root of the reversal of p^2 is neither p nor the reversal of p are a(69) = 110092211 and a(81) = 112191011 (whose squares are each other's reversals).

%C For n>1, the first decimal digit of a(n)^2 is either 1 or 9. - _Chai Wah Wu_, Apr 07 2026

%e a(5) = 31 is a term because 31^2 = 961 whose reversal 169 = 13^2, and 13 is prime.

%p filter:= proc(p) local r;

%p if not isprime(p) then return false fi;

%p r:= rev(p^2);

%p issqr(r) and isprime(sqrt(r))

%p end proc:

%p select(filter, [2,seq(i,i=3..2*10^6,2)]);

%t Select[Prime[Range[10^5]],PrimeQ[Sqrt[IntegerReverse[#^2]]] &] (* _Stefano Spezia_, Apr 05 2026 *)

%o (PARI) isok(p) = if (isprime(p), my(r = fromdigits(Vecrev(digits(p^2)))); issquare(r) && isprime(sqrtint(r))); \\ _Michel Marcus_, Apr 05 2026

%o (Python)

%o from itertools import count, islice

%o from math import isqrt

%o from sympy import primerange, integer_nthroot, isprime

%o def A393520_gen(): # generator of terms

%o yield 2

%o for l in count(0):

%o for p in primerange(isqrt(m:=10**l)+1,isqrt((m<<1)-1)+1):

%o q, r = integer_nthroot(int(str(p**2)[::-1]),2)

%o if r and isprime(q):

%o yield p

%o for p in primerange(isqrt(9*m),isqrt(10*m-1)+1):

%o q, r = integer_nthroot(int(str(p**2)[::-1]),2)

%o if r and isprime(q):

%o yield p

%o A393520_list = list(islice(A393520_gen(),40)) # _Chai Wah Wu_, Apr 07 2026

%Y Cf. A085306. Contains A065378.

%K nonn,base

%O 1,1

%A _Robert Israel_, Apr 05 2026