login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
OFFSET
1,7
FORMULA
a(n) = A039999(A000079(n)).
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
(PARI) \\ here b(n) is A039999.
b(n)={my(D=vecsort(digits(n)), S=0); forperm(D, p, if(isprime(fromdigits(Vec(p))), S++)); S}
{ for(n=1, 30, print1(b(2^n), ", ")) } \\ Andrew Howroyd, Jan 05 2020
(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))))
print([a(n) for n in range(1, 31)]) # Michael S. Branicky, May 25 2023
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Labos Elemer, Aug 04 2003
EXTENSIONS
a(27)-a(44) from Andrew Howroyd, Jan 05 2020
a(45)-a(49) from Michael S. Branicky, May 26 2023
STATUS
approved