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.
%I A046891 #17 Feb 18 2024 05:42:22 %S A046891 1,2,13,103,107,1007,1013,1049,1079,1237,10013,10039,10079,10139, %T A046891 10237,10279,10379,13789,100127,100139,100235,100237,100279,101237, %U A046891 101239,102347,102367,102379,103579,103789,1001234,1001237,1001239,1002347,1002359,1002367,1002379 %N A046891 Values of n where number of permutations of digits a(n) that are prime increases. %H A046891 Michael S. Branicky, <a href="/A046891/b046891.txt">Table of n, a(n) for n = 1..91</a> %t A046891 ap[n_] := Count[FromDigits /@ Permutations[IntegerDigits[n]], _?PrimeQ]; t = {1}; x = 0; Do[If[ap[i] > x, AppendTo[t, i]; x = ap[i]], {i, 105000}]; t (* _Jayanta Basu_, Jun 29 2013 *) %o A046891 (Python) %o A046891 from sympy import prime %o A046891 from gmpy2 import is_prime %o A046891 from sympy.utilities.iterables import multiset_permutations as mp %o A046891 from itertools import count, islice, combinations_with_replacement as mc %o A046891 def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p)))) %o A046891 def bgen(d): %o A046891 for f in "123456789": %o A046891 yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1))) %o A046891 def agen(): %o A046891 record = -1 %o A046891 for d in count(1): %o A046891 for k in bgen(d): %o A046891 v = f(k) %o A046891 if v > record: %o A046891 record = v %o A046891 yield k %o A046891 print(list(islice(agen(), 30))) # _Michael S. Branicky_, Feb 17 2024 %Y A046891 Cf. A039999, A046892. %K A046891 nonn,base %O A046891 1,2 %A A046891 _David W. Wilson_ %E A046891 a(35) and beyond from _Michael S. Branicky_, Feb 17 2024