cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A086151 Number of permutations of decimal digits of 2^n which yield a prime.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Aug 04 2003

Keywords

Examples

			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}.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[Table[PrimeQ[tn[Part[Permutations[ IntegerDigits[2^w]], j]]], {j, 1, Length[Permutations[ IntegerDigits[2^w]]]}], True], {w, 1, 20}]
  • 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

Formula

a(n) = A039999(A000079(n)).

Extensions

a(27)-a(44) from Andrew Howroyd, Jan 05 2020
a(45)-a(49) from Michael S. Branicky, May 26 2023
Showing 1-1 of 1 results.