login
Primes which remain prime when the last digit is replaced by its square.
2

%I #28 Sep 08 2022 08:46:08

%S 11,13,17,19,23,29,31,37,41,47,53,61,71,73,83,89,101,103,107,127,131,

%T 139,149,151,157,173,181,191,193,197,211,223,229,233,239,241,251,257,

%U 263,271,277,281,307,311,331,347,353,359,373,383,389,401,421,431,433

%N Primes which remain prime when the last digit is replaced by its square.

%H Vincenzo Librandi, <a href="/A244555/b244555.txt">Table of n, a(n) for n = 1..9000</a>

%e 107 is in the sequence because 7^2=49 and 1049 is a prime.

%e 449 is in the sequence because 9^2=81 and 4481 is a prime.

%t selQ[p_] := (id = IntegerDigits[p]; id1 = Most[id]; id2 = Last[id]^2 // IntegerDigits; p2 = Join[id1, id2] // FromDigits; PrimeQ[p2]); Select[Array[Prime, 100], selQ] (* _Jean-François Alcover_, Jul 04 2014 *)

%o (Magma) r:=func<i | Seqint(Intseq(Intseq(i)[1]^2) cat Intseq(Floor(i/10)))>; [p: p in PrimesUpTo(500) | IsPrime(r(p))]; // _Bruno Berselli_, Jul 04 2014

%o (PARI) lista(nn) = {forprime(p=2, nn, d = p % 10; if (isprime(eval(concat(Str(p\10), Str(d^2)))), print1(p, ", ")););} \\ _Michel Marcus_, Jul 04 2014

%Y Cf. A030430 (subsequence).

%K nonn,base

%O 1,1

%A _Vincenzo Librandi_, Jul 02 2014