[go: up one dir, main page]

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!)
Revision History for A373179 (Underlined text is an addition; strikethrough text is a deletion.)

newer changes | Showing entries 11-20 | older changes
A373179 a(n) is the smallest n-digit integer whose digit permutations make the maximum possible number of n-digit primes.
(history; published version)
#30 by Kevin Ryde at Thu May 30 05:07:08 EDT 2024
COMMENTS

A065851(n) is the maximum number of n-digit primes which can be made by permuting n digits, and a(n) is the smallest number which reaches this maximum.

a(n) ishas theits 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).

STATUS

proposed

editing

#29 by Michael S. Branicky at Wed May 29 12:24:32 EDT 2024
STATUS

editing

proposed

#28 by Michael S. Branicky at Wed May 29 12:24:04 EDT 2024
PROG

c[smallest("".["".join(sorted(str(p))))] += )))] += 1

m = min(c.most_common(1))), key=lambda x:smallest(x[0]))

return smallest(m[0] # ]) # m[1] generates A065851

STATUS

proposed

editing

Discussion
Wed May 29 12:24
Michael S. Branicky: slightly faster to do at end
#27 by Michael S. Branicky at Wed May 29 11:58:41 EDT 2024
STATUS

editing

proposed

#26 by Michael S. Branicky at Wed May 29 11:58:21 EDT 2024
PROG

c["".[smallest("".join(sorted(str(p)))] += ))))] += 1

return smallest(m[0]) # ] # m[1] generates A065851

STATUS

proposed

editing

Discussion
Wed May 29 11:58
Michael S. Branicky: Yes.  Updated.
#25 by Michael S. Branicky at Tue May 28 09:11:55 EDT 2024
STATUS

editing

proposed

Discussion
Tue May 28 21:20
Kevin Ryde: Oh, also it's possible the maximum count is attained by more than one digit set, eg. n=3 of the example.  In that case pick the smallest of the "smallest()".  I think it doesn't happens for n=5..11, but have to watch.
#24 by Michael S. Branicky at Tue May 28 09:08:47 EDT 2024
PROG

print([a(n) for n in range(21, 78)]) # Michael S. Branicky, May 28 2024

Discussion
Tue May 28 09:11
Michael S. Branicky: Indeed, Kevin!  Shorter too!
#23 by Michael S. Branicky at Tue May 28 09:08:06 EDT 2024
PROG

from sympy import isprimenextprime

from itertoolscollections import combinations_with_replacementCounter

from sympy.utilities.iterables import multiset_permutations

s = "".join(nzt) if "0" not in t else nz[0]+"0"*t.count("0")+nz[1:]

mxc, argmx = -p = Counter(), nextprime(10**(n-1, None))

for u in combinations_with_replacement("0123456789", n):

s, first, ufirst = 0, False, None

if sum(int(ui) for ui in u)%3 != 0:

while p < 10**n:

c["".join(sorted(str(p)))] += 1

p = nextprime(p)

m = min(c.most_common(1))

return smallest(m[0]) # m[1] generates A065851

print([a(n) for pn in multiset_permutationsrange(u):2, 7)]) # _Michael S. Branicky_, May 28 2024

if p[0] != "0" and isprime(int("".join(p))):

s += 1

if not first:

ufirst, first = int("".join(p)), True

if s > mx:

mx, argmx = s, u # use ufirst for smallest prime

return smallest(argmx) # mx here generates A065851

print([a(n) for n in range(1, 8)]) # Michael S. Branicky, May 27 2024

STATUS

proposed

editing

#22 by Michael S. Branicky at Mon May 27 23:49:52 EDT 2024
STATUS

editing

proposed

Discussion
Tue May 28 01:48
Gonzalo Martínez: Thank you very much, Kevin and Michael :D
04:10
Kevin Ryde: On the code front, I tried the other direction: Go through all primes, get their digit sets (multi-sets), count how many of each.  There's a lot of primes, but relatively few resulting sets.  Eg. n=12 is binomial(12+9,9) = about 300k.
#21 by Michael S. Branicky at Mon May 27 23:49:45 EDT 2024
DATA

2, 13, 149, 1237, 13789, 123479, 1235789, 12345679, 102345679, 1123456789, 10123456789

EXTENSIONS

a(9)-a(1011) from Michael S. Branicky, May 27 2024

STATUS

proposed

editing

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 August 29 23:34 EDT 2024. Contains 375520 sequences. (Running on oeis4.)