OFFSET
0,1
COMMENTS
C1 = 'nextprime(n) followed by n'
C2 = 'n followed by prevprime(n)'
EXAMPLE
n=1881 -> next prime is 1889, previous prime is 1879, thus '18891881' and '18811879' are both primes.
MATHEMATICA
okQ[n_]:=Module[{idn=IntegerDigits[n], ida, idb}, ida=IntegerDigits[NextPrime[n, -1]]; idb=IntegerDigits[NextPrime[n]]; PrimeQ[FromDigits[Join[idn, ida]]]&&PrimeQ[FromDigits[Join[idb, idn]]]]
Select[Range[5000], okQ] (* Harvey P. Dale, Dec 25 2010 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Oct 15 1998
STATUS
approved