|
|
A086151
|
|
Number of permutations of decimal digits of 2^n which yield a prime.
|
|
0
|
|
|
1, 0, 0, 1, 1, 0, 2, 0, 2, 4, 0, 0, 5, 19, 10, 3, 87, 9, 0, 377, 293, 84, 9, 265, 142, 502, 4916, 979, 30453, 38758, 15274, 5270, 10463, 81628, 69189, 91023, 1605954, 378559, 152874, 3447170, 220776, 4350954, 1746163, 51889555, 12949705, 5145813, 202624585, 404342074, 118292490
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,7
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
n=19: 2^19 = 524288, has 180 permutations, each composite, a(19)=0;
n=13: 2^13 = 8192, the following 5 of the 24 permutations provide primes: {8219, 8291, 1289, 9281, 2819}.
|
|
MATHEMATICA
|
Table[Count[Table[PrimeQ[tn[Part[Permutations[ IntegerDigits[2^w]], j]]], {j, 1, Length[Permutations[ IntegerDigits[2^w]]]}], True], {w, 1, 20}]
|
|
PROG
|
b(n)={my(D=vecsort(digits(n)), S=0); forperm(D, p, if(isprime(fromdigits(Vec(p))), S++)); S}
(Python)
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations as mp
def a(n): return sum(1 for p in mp(str(2**n)) if isprime(int("".join(p))))
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|