login
Smallest prime p such that, for every positive integer k <= n, the concatenation of p, prime(k)^2 and reverse(p) is prime.
0

%I #16 Aug 16 2015 18:04:02

%S 11,17,1097,7949,780587,123638027,3259714649,76526081651

%N Smallest prime p such that, for every positive integer k <= n, the concatenation of p, prime(k)^2 and reverse(p) is prime.

%C a(8) found by _Hans Havermann_.

%H Carlos Rivera Puzzles, <a href="http://www.primepuzzles.net/puzzles/puzz_788.htm">Puzzle 788. P&p(i)^2&RP</a>

%e a(3)=1097 because 109747901 (1097&2^2&7901) and 109797901 (1097&3^2&7901) and 1097257901 (1097&5^2&7901) are prime numbers, and 1097 is the smallest prime for which this is the case.

%t f[n_, k_] := FromDigits[Join[

%t IntegerDigits[n], IntegerDigits[Prime[k]^2],

%t Reverse[IntegerDigits[n]]]]

%t a[n_] := Module[{p = 2, k = 1},

%t While[k <= n,

%t If[PrimeQ[f[p, k]], k++, p = NextPrime[p]; k = 1];

%t ];

%t Return[p]

%t ](* _Kellen Myers_, Aug 16 2015 , note this is very slow *)

%K nonn,base,more

%O 1,1

%A _Vicente Izquierdo Gomez_, Jul 04 2015