%I #11 Sep 28 2017 19:44:12
%S 2365471,2375641,2456371,2456731,2457613,2467351,2476351,2516473,
%T 2547613,2547631,2561743,2576341,2645371,2651743,2653741,2657143,
%U 2657341,2716453,2741653,2761453,2765143,3452671,3456721,3462751,3465271,3467251,3526741,3546271,3546721,3576421,3627451,3672451,3675241,3752641,3756241,3756421
%N Seven-digit primes with derangement of digits 1..7.
%C No digit is on its "right" place. There are exactly 143 such primes.
%C The only another possible case: four-digit primes with a derangement of digits 1..4 gives two primes 2143, 2341. There are no such primes with m=1,2,3,5,6,8,9 decimal digits 1..m.
%H Zak Seidov, <a href="/A187016/b187016.txt">Table of n, a(n) for n = 1..143</a> (complete list)
%e 2365471 is prime and 2 is not at 2nd place, 3 - not at 3rd place, 6 - not at 6th place, ..., 1 - not at the first place. Largest such prime is a(143)=7652413.
%t derangQ[n_]:=Count[Thread[{n,Range[7]}],_?(#[[1]]==#[[2]]&)]==0; With[ {p7=Permutations[Range[7]]},Select[p7,derangQ[#]&&PrimeQ[ FromDigits[ #]]&]] (* _Harvey P. Dale_, Sep 28 2017 *)
%Y Cf. A000166.
%K nonn,base,fini,full
%O 1,1
%A _Zak Seidov_, Mar 01 2011
|