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!)
A373179 a(n) is the smallest n-digit integer whose digit permutations make the maximum possible number of n-digit primes. 1
2, 13, 149, 1237, 13789, 123479, 1235789, 12345679, 102345679, 1123456789, 10123456789, 1011233456789, 1012334567789, 10123345677899 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
A065851(n) is the maximum number of n-digit primes which can be made by permuting n digits.
a(n) = k is the smallest n-digit k for which A046810(k) = A065851(n).
a(n) has its relevant digits sorted and not beginning with 0 and may or may not be one of the primes (it is for n = 1 to 7, but not at n = 8).
LINKS
Kevin Ryde, C Code
EXAMPLE
For n=3, A065851(3) = 4 primes are reached by permuting the digits of a(3) = 149, namely {149, 419, 491, 941}. (4 primes are also reached from 179 and 379, but they're bigger numbers.)
PROG
(Python)
from sympy import nextprime
from collections import Counter
def smallest(t):
nz = "".join(sorted(c for c in t if c != "0"))
s = "".join(t) if "0" not in t else nz[0]+"0"*t.count("0")+nz[1:]
return int(s)
def a(n):
c, p = Counter(), nextprime(10**(n-1))
while p < 10**n:
c["".join(sorted(str(p)))] += 1
p = nextprime(p)
m = min(c.most_common(1), key=lambda x:smallest(x[0]))
return smallest(m[0]) # m[1] generates A065851
print([a(n) for n in range(1, 8)]) # Michael S. Branicky, May 28 2024
(C) /* See links. */
CROSSREFS
Sequence in context: A059367 A309799 A324464 * A364339 A204554 A069736
KEYWORD
nonn,base,more,changed
AUTHOR
Gonzalo Martínez, May 26 2024
EXTENSIONS
a(9)-a(11) from Michael S. Branicky, May 27 2024
a(12)-a(14) from Kevin Ryde, Jul 16 2024
STATUS
approved

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 July 29 21:21 EDT 2024. Contains 374734 sequences. (Running on oeis4.)