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.

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

This page as a plain text file.
%I A086151 #17 May 26 2023 10:47:46
%S A086151 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,
%T A086151 4916,979,30453,38758,15274,5270,10463,81628,69189,91023,1605954,
%U A086151 378559,152874,3447170,220776,4350954,1746163,51889555,12949705,5145813,202624585,404342074,118292490
%N A086151 Number of permutations of decimal digits of 2^n which yield a prime.
%F A086151 a(n) = A039999(A000079(n)).
%e A086151 n=19: 2^19 = 524288, has 180 permutations, each composite, a(19)=0;
%e A086151 n=13: 2^13 = 8192, the following 5 of the 24 permutations provide primes: {8219, 8291, 1289, 9281, 2819}.
%t A086151 Table[Count[Table[PrimeQ[tn[Part[Permutations[ IntegerDigits[2^w]], j]]], {j, 1, Length[Permutations[ IntegerDigits[2^w]]]}], True], {w, 1, 20}]
%o A086151 (PARI) \\ here b(n) is A039999.
%o A086151 b(n)={my(D=vecsort(digits(n)), S=0); forperm(D, p, if(isprime(fromdigits(Vec(p))),  S++)); S}
%o A086151 { for(n=1, 30, print1(b(2^n), ", ")) } \\ _Andrew Howroyd_, Jan 05 2020
%o A086151 (Python)
%o A086151 from sympy import isprime
%o A086151 from sympy.utilities.iterables import multiset_permutations as mp
%o A086151 def a(n): return sum(1 for p in mp(str(2**n)) if isprime(int("".join(p))))
%o A086151 print([a(n) for n in range(1, 31)]) # _Michael S. Branicky_, May 25 2023
%Y A086151 Cf. A039999, A086150, A000079.
%K A086151 base,nonn
%O A086151 1,7
%A A086151 _Labos Elemer_, Aug 04 2003
%E A086151 a(27)-a(44) from _Andrew Howroyd_, Jan 05 2020
%E A086151 a(45)-a(49) from _Michael S. Branicky_, May 26 2023