A086150 Number of permutations of decimal digits of n which yield nonprime numbers.
1, 0, 0, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0, 1, 2, 1, 0, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 0, 1, 1, 1, 1, 2, 0, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 0, 2, 0, 1, 2, 1, 1, 2, 0, 2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 0, 1, 1, 3, 1, 6, 3, 4, 6
Offset: 1
Examples
n=117, digit-permutations={117,171,711} are all composites, so a(117)=3.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(L) option remember; nops(remove(isprime, map(t -> add(t[i]*10^(i-1),i=1..nops(t)), combinat:-permute(L)))) end proc: seq(f(sort(convert(n,base,10))),n=1..200); # Robert Israel, Aug 13 2017
-
Mathematica
nd[x_, y_] := 10*x+y tn[x_] := Fold[nd, 0, x] Table[Count[Table[PrimeQ[tn[Part[Permutations[ IntegerDigits[w]], j]]], {j, 1, Length[Permutations[ IntegerDigits[w]]]}], False], {w, 1, 128}] Table[Count[FromDigits/@Permutations[IntegerDigits[n]],?(!PrimeQ[#]&)],{n,110}] (* _Harvey P. Dale, Dec 24 2016 *)
Comments