|
|
A065851
|
|
Let u be any string of n digits from {0,...,9}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u; then a(n) = max_u f(u).
|
|
11
|
|
|
1, 2, 4, 11, 39, 148, 731, 4333, 26519, 152526, 1251724
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
a(12) >= 7627713. a(13) >= 49545041.
There are A006879(12) = 33489857205 primes with 12 digits. There are 2.4*10^11 numbers with 12 digits that are coprime to 30 (i.e. end in 1, 3, 7, 9 and have a digital sum not divisible by 3).
On average one in 2.4*10^11/33489857205 ~= 7.166 of these numbers with 12 digits is prime.
Let maxqprimes(d) be the number of permutations of digits of d without leading 0 and ending in 1, 3, 7 or 9.
Let qprimes(d) be the number of permutations of digits of d (without leading 0 and ending in 1, 3, 7 or 9) that are prime.
a(12) = 7627713 if for some number with 12 digits we have maxprimes(d)/qprimes(d) < 5 (found via a brute force check). This is much less than the expected 7.166.
(At least) 101233456789 with 12 digits has maxqprimes(101233456789) = 54432000. This d = 101233456789 has a shared record for largest value for maxqprimes(d), along with d in {101234567789, 101234567899, 102334567789, 102345677899}. This gives maxqprimes(101233456789)/qprimes(101233456789) ~= 7.136, close to the expected 7.166.
The values d that have maxqprimes(d) >= 5*7627713 all have maxqprimes(d)/qprimes(d) >= 7.13.
For a(12) there are 2.4*10^11 checks needed if we do not use the found bound of 7627713. If we do we can bring down the search space by a factor of about 4 (without any heuristic). If we increase to 7*7627713 we only have about 9*10^8 needed checks left to do. (End)
|
|
LINKS
|
|
|
EXAMPLE
|
a(2) = 2 because 13 and 31 are primes.
a(3) = 4 because {149, 419, 491, 941} or {179, 197, 719, 971} or {379, 397, 739, 937} are primes. - R. J. Mathar, Apr 23 2016
|
|
MATHEMATICA
|
c[x_] := Module[{},
Length[Select[Permutations[x],
First[#] != 0 && PrimeQ[FromDigits[#, 10]] &]]];
Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 9], n],
Table[Count[#, i], {i, 0, 9}] &]]]]];
|
|
PROG
|
(Python)
from sympy import isprime
from itertools import combinations_with_replacement
from sympy.utilities.iterables import multiset_permutations
def a(n): return max(sum(1 for p in multiset_permutations(u) if p[0] != "0" and isprime(int("".join(p)))) for u in combinations_with_replacement("0123456789", n) if sum(int(ui) for ui in u)%3)
|
|
CROSSREFS
|
Cf. A006879, A065843, A065844, A065845, A065846, A065847, A065848, A065849, A065850, A065852, A065853.
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|