%I #8 Dec 05 2013 19:55:19
%S 11,313,0,727,919,11311,13313,0,17117,19219,21121,23623,0,27127,29129,
%T 31231,33533,0,37337,39139,41141,43543,0,47147,49549,51151,53353,0,
%U 57457,59159,61261,63463,0,67567,692269,71171,73673,0,77377,79279
%N Smallest prime > 2n+1 beginning and ending with 2n+1, or 0 if no such prime exists.
%C No such prime exists if n is even or divisible by 5. It is not until n = 69 that it necessary to insert more than one digit. The next few examples are 99, 101, 103, 123, 157, 181 & 199.
%t f[n_] := Block[{a = IntegerDigits[n]}, If[ Mod[n, 5] == 0, Return[0], If[ p = FromDigits[ Join[a, a]]; PrimeQ[p], Return[p], k = 0; While[p = FromDigits[ Join[a, IntegerDigits[k], a]]; !PrimeQ[p], k++ ]]; p]]; Table[ f[n], {n, 1, 89, 2}]
%K base,nonn
%O 0,1
%A _Amarnath Murthy_, May 07 2002
%E Edited by _N. J. A. Sloane_, _Vladeta Jovovic_ and _Robert G. Wilson v_, May 09 2002
|