OFFSET
1,1
COMMENTS
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..5000 (first 3565 terms from Felix Fröhlich)
EXAMPLE
137 is a term because it is prime and 173 and 317 are also prime.
173 is not a term because 713 is not prime (even though 173 and 137 are prime). {Hence none of 137,173,317,371,713,731 is a term of A003459.}
3119 is a term because it is prime and 1319 and 3191 are primes.
As 3119, 1193, 1931 and 9311 are all prime, 3119 is also a term of A068652.
Finally, although 1913 is also prime, neither 1139, 1391, 3911, 9113, nor 9131 is prime so 3119's twelve total permutations are not terms of A003459.
MATHEMATICA
swap[lst_List, i_Integer] := Block[{lsu = lst}, ReplacePart[ lsu, {i -> lsu[[i + 1]], i + 1 -> lsu[[i]]}]]; fQ[n_] := Block[{id = IntegerDigits@ n, l = Floor@ Log10@ n}, And @@ Table[ PrimeQ@ FromDigits@ swap[id, j], {j, l}] == True]; Select[ Prime@ Range@ 500, fQ] (* Robert G. Wilson v, Nov 29 2014 *)
PROG
(PARI) eva(n) = subst(Pol(n), x, 10)
switchdigits(v, pos) = my(vt=v[pos]); v[pos]=v[pos+1]; v[pos+1]=vt; v
is(n) = my(d=digits(n)); for(k=1, #d-1, if(!ispseudoprime(eva(switchdigits(d, k))), return(0))); 1
forprime(p=1, , if(is(p), print1(p, ", "))) \\ Felix Fröhlich, Sep 21 2019
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Rick L. Shepherd, May 24 2005
EXTENSIONS
Offset changed from 0 to 1 by Felix Fröhlich, Sep 21 2019
STATUS
approved