login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A046892 Number of permutations of digits of A046891(n) that are primes. 3

%I #15 Feb 18 2024 05:44:15

%S 0,1,2,3,4,5,8,9,10,11,13,16,18,22,31,34,37,39,40,49,52,64,80,87,93,

%T 115,121,144,149,160,172,225,233,298,299,308,384,399,408,423,475,484,

%U 569,571,738,806,835,863,934,1247,1413,1525,1739,1775,2282,2303,2325

%N Number of permutations of digits of A046891(n) that are primes.

%H Michael S. Branicky, <a href="/A046892/b046892.txt">Table of n, a(n) for n = 1..91</a>

%t a = {}; b = -1; Do[c = Count[ PrimeQ[ FromDigits /@ Permutations[IntegerDigits[n]]], True]; If[c > b, b = c; a = Append[a, c]], {n, 1, 10^8}]; a

%o (Python)

%o from sympy import prime

%o from gmpy2 import is_prime

%o from sympy.utilities.iterables import multiset_permutations as mp

%o from itertools import count, islice, combinations_with_replacement as mc

%o def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p))))

%o def bgen(d):

%o for f in "123456789":

%o yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1)))

%o def agen():

%o record = -1

%o for d in count(1):

%o for k in bgen(d):

%o v = f(k)

%o if v > record:

%o record = v

%o yield v

%o print(list(islice(agen(), 30))) # _Michael S. Branicky_, Feb 17 2024

%Y Cf. A039999, A046891.

%K nonn,base

%O 1,3

%A _David W. Wilson_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)