login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A046891
Values of n where number of permutations of digits a(n) that are prime increases.
3
1, 2, 13, 103, 107, 1007, 1013, 1049, 1079, 1237, 10013, 10039, 10079, 10139, 10237, 10279, 10379, 13789, 100127, 100139, 100235, 100237, 100279, 101237, 101239, 102347, 102367, 102379, 103579, 103789, 1001234, 1001237, 1001239, 1002347, 1002359, 1002367, 1002379
OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..91
MATHEMATICA
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 *)
PROG
(Python)
from sympy import prime
from gmpy2 import is_prime
from sympy.utilities.iterables import multiset_permutations as mp
from itertools import count, islice, combinations_with_replacement as mc
def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p))))
def bgen(d):
for f in "123456789":
yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1)))
def agen():
record = -1
for d in count(1):
for k in bgen(d):
v = f(k)
if v > record:
record = v
yield k
print(list(islice(agen(), 30))) # Michael S. Branicky, Feb 17 2024
CROSSREFS
Sequence in context: A371578 A266906 A107000 * A046893 A354159 A126036
KEYWORD
nonn,base
EXTENSIONS
a(35) and beyond from Michael S. Branicky, Feb 17 2024
STATUS
approved