This week the #puzzle is: Can You Pile the Primes? #primes #coding #BruteForce #oeis #subsets
| Suppose you want to make two groups with equal sums using the first N2 prime numbers. What is the smallest value of N2 for which you can do this? |
| The answer is three! (Clearly, that wasn’t actually the puzzle.) |
| The first three primes are 2, 3, and 5, and you can split them up into two sets: {2, 3} and {5}. Sure enough, 2 + 3 = 5. |
| Your puzzle involves making three groups with equal sums using the first N3 prime numbers. What is the smallest value of N3 for which you can do this? |
And for extra credit:
| Now you want to make six groups with equal sums using the first N6 prime numbers. What is the smallest value of N6 for which you can do this? |

Intermission
I am very excited, because this is the last fiddler of Q1, and I still have maximum points. Wish me luck.
Solution, possibly incorrect:
Method 1: Write a brute force program. This actually finds a solution rather quickly. N2 is confirmed, among other things.
Testing N1 = 1. Testing these primes: 2
................. Group 1: 2
................. Sum of groups: 2
................. N1 = 1
Testing N2 = 2. Sum of primes 5 isn't a multiple of 2, rejected.
Testing N2 = 3. Testing these primes: 5,3,2
................. Group 1: 5
................. Group 2: 3,2
................. Sum of groups: 5
................. N2 = 3
Testing N3 = 3. Sum of primes 10 isn't a multiple of 3, rejected.
Testing N3 = 4. Sum of primes 17 isn't a multiple of 3, rejected.
Testing N3 = 5. Sum of primes 28 isn't a multiple of 3, rejected.
Testing N3 = 6. Sum of primes 41 isn't a multiple of 3, rejected.
Testing N3 = 7. Sum of primes 58 isn't a multiple of 3, rejected.
Testing N3 = 8. Sum of primes 77 isn't a multiple of 3, rejected.
Testing N3 = 9. Sum of primes 100 isn't a multiple of 3, rejected.
Testing N3 = 10. Testing these primes: 29,23,19,17,13,11,7,5,3,2
................. Group 1: 29,7,5,2
................. Group 2: 23,17,3
................. Group 3: 19,13,11
................. Sum of groups: 43
................. N3 = 10
Result: N3 = 10.
And for extra credit:
Method 1: The same program.
N6 has to be at least 57. But then my program gives up. Heat death of the universe kind of thing.
Testing N6 = 57.
Testing these primes:
269,263,257,251,241,239,233,229,227,223,
211,199,197,193,191,181,179,173,167,163,
157,151,149,139,137,131,127,113,109,107,
103,101,97,89,83,79,73,71,67,61,59,53,
47,43,41,37,31,29,23,19,17,13,11,7,5,3,2
Or rather, test left as an exercise for the reader.
Method 2: Try to find a solution with the first 57 primes. And I do!
- 269,199,197,139,137,89,59,37,19
- 263,211,181,163,109,103,53,47,13,2
- 257,223,173,167,107,101,71,41,5
- 251,227,179,157,127,83,61,31,29
- 241,229,193,151,113,97,67,43,11
- 239,233,191,149,131,79,73,23,17,7,3
N6 = 57.
Method 3: Look for an OEIS sequence. Found. Results confirmed.