Puzzle No. 49.- If you are given K numbers of
each from 0 to 9, find the maximum quantity of primes
that can be formed using those 10K numbers.

Comments:

Its obvious that the upper limit to the
quantity of primes asked is 4K+2.
Less obvious is how many can be effectively obtained for
every particular K.

Using a code that materializes a strategy developed
by my friend Jaime Ayala,
I have gotten the following results:

a)
For K=1 to 6 the primes that can be effectively obtained
match the upper limit.

b)
For K>6 the maximum quantity of primes that can be
effectively obtained is less than the upper limit.

c)
For any K the set of primes  solution is not
unique; that is to say, several distinct sets of primes
share the same maximum quantity of primes that can be
effectively obtained.

d)
Except for K=8, and according to the Ayala's strategy
(and/or my code of it) there are always some numbers
(digits) unused.

Examples:

For K= 1, the upper limit is 6 and the set of primes
that can be formed is {2, 3, 5, 7, 41, 89} remaining
unused two digits, one 0 and one "6".

For K= 2, the upper limit is 10 and the set of primes
that can be formed is {2, 3, 5, 7, 23, 41, 47, 59, 61,
89} remaining unused four digits, two 0, one
"6" and one 8.

The rest of our results are summarized in the
following table:

K

Upper
Limit

Quantity
of primes obtained

Quantity
of Digits unused

1

6

6

2

2

10

10

4

3

14

14

2

4

18

18

4

5

22

22

2

6

26

26

1

7

30

29

2

8

34

33

0

9

38

36

1

10

42

39

3

50

202

154

4

100

402

285

19

Can you improve the above
results, that is to say, can you obtain more primes
and/or decrease the digits unused?

Of course that what we are looking for here is not a
hand & eye procedure but a strategy that
may generate a code for PC.

Anurag Sahay wrote (May, 2005):

Today I started working on puzzle 49. I did not use the
computer to solve it, because , for this puzzle I cannot think of any
algorithm which is more efficient (and quicker!) than the human brain!...I
got a better ( 156 primes) count for k=50 (1 digit unused : 1): (I am sure
this is not the best: I guess 160 is reachable).

Regarding this strategy & results we don't claim that it will produce the
largest total primes for a given K value. At the most we claim that with
these very simple rules we can get results very close to the largest
possible ones, without too much pain (that is to say, mechanically in
a few seconds)

Example 1: while with this strategy for K=20 we find at
the most TP=72, Jaime Ayala has found 'by another route' a set of TP=73: