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.

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

This page as a plain text file.
%I A046892 #15 Feb 18 2024 05:44:15
%S A046892 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 A046892 115,121,144,149,160,172,225,233,298,299,308,384,399,408,423,475,484,
%U A046892 569,571,738,806,835,863,934,1247,1413,1525,1739,1775,2282,2303,2325
%N A046892 Number of permutations of digits of A046891(n) that are primes.
%H A046892 Michael S. Branicky, <a href="/A046892/b046892.txt">Table of n, a(n) for n = 1..91</a>
%t A046892 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 A046892 (Python)
%o A046892 from sympy import prime
%o A046892 from gmpy2 import is_prime
%o A046892 from sympy.utilities.iterables import multiset_permutations as mp
%o A046892 from itertools import count, islice, combinations_with_replacement as mc
%o A046892 def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p))))
%o A046892 def bgen(d):
%o A046892     for f in "123456789":
%o A046892         yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1)))
%o A046892 def agen():
%o A046892     record = -1
%o A046892     for d in count(1):
%o A046892         for k in bgen(d):
%o A046892             v = f(k)
%o A046892             if v > record:
%o A046892                 record = v
%o A046892                 yield v
%o A046892 print(list(islice(agen(), 30))) # _Michael S. Branicky_, Feb 17 2024
%Y A046892 Cf. A039999, A046891.
%K A046892 nonn,base
%O A046892 1,3
%A A046892 _David W. Wilson_