Can You Pile the Primes?¶

Fiddler¶

From Dean Ballard comes a premier puzzle of primes:

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?

Solution¶

$3\vert N_3$, and more generally, $k\vert N_k$.

$N_3$ can be $10, 14, 16, 18, 24...$.

The first $10$ prime numbers are $2, 3, 5, 7, 11, 13, 17, 19, 23, 29$ and their sum is $129$.

Answer¶

For $N_3 = 10$, $3$ groups of $43$ :

  • $2,5,17,19$
  • $7,13,23$
  • $3,11,29$

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?

Solution¶

The sum of the first $57$ primes is the first time the sum is divisible by $6$. The sum is $6,870$ which yields $1145$ per group.

Incorporating as many of the largest numbers as possible and using as few additional numbers as possible is one dirty algorithm to determine the groups. I did not need to code this as I achieved answers fairly quickly.

  1. Arrange the $N_k$ primes in ascending order.
  2. Sum as many of the largest primes that is still less than the group sum.
  3. Determine if $1$, $2$, or $3$ additional primes are necessary to achieve the group sum.
  4. Try to use the largest primes as possible, thus, the fewest number of primes as possible to achieve the sum. This allows for more smaller numbers making the last two groups much easier.
  5. Remove the primes that achieved the group sum.
  6. If there are 3 or more groups remaining, go to 2).
  7. Otherwise, there are 2 groups remaining. It should be relatively easy to quickly find a group sum with the many of the smaller primes.

Answer¶

For $N_6 = 57$, $6$ groups of $1145$ :

  • $2, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 61, 67, 71, 73, 83, 89, 97, 101, 103, 107$
  • $59, 109, 113, 131, 137, 139, 149, 151, 157$
  • $79, 163, 167, 173, 179, 191, 193$
  • $5, 83, 197, 199, 211, 223, 227$
  • $181, 233, 239, 241, 251$
  • $127, 229, 257, 263, 269$

$N_4$¶

  • $2+3+5+7+11 = 28$, but impossible to achieve four groups of $7$.
  • $2+3+5+7+11+13+17+19+23 = 100$, but impossible to achieve four groups of $25$.

For $N_4 = 11$, $4$ groups of $40$ :

  • $3, 5, 13, 19$
  • $2, 3, 23, 31$
  • $5, 17, 37$
  • $7, 13, 39$

$N_5$¶

  • $2+3 = 5$, but impossible to achieve five groups of $1$.
  • $2+3+5 = 10$, but impossible to achieve five groups of $2$.
  • $2+3+5+\cdots+23 = 100$, but impossible to achieve five groups of $20$.
  • $2+3+5+\cdots+31 = 160$, but impossible to achieve five groups of $32$.

For $N_5 = 17$, $5$ groups of $88$ :

  • $2, 13, 19, 23, 31$
  • $3, 5, 37, 43$
  • $41, 47$
  • $7, 11, 17, 53$
  • $29, 59$

$N_7$¶

  • $2+3+5+7+11 = 28$, but impossible to achieve seven groups of $4$.
  • $2+3+5+\cdots+19 = 77$, but impossible to achieve seven groups of $11$.
  • $2+3+5+\cdots+41 = 238$, but impossible to achieve seven groups of $34$.

For $N_7= 22$, $7$ groups of $113$ :

  • $17, 43, 53$
  • $7, 47, 59$
  • $11, 41, 61$
  • $2, 13, 31, , 67$
  • $19, 23, 71$
  • $3, 37, 73$
  • $5, 29, 79$

$N_8$¶

  • $2+3+5+\cdots+31 = 160$, but impossible to achieve eight groups of $20$.
  • $2+3+5+\cdots+47 = 328$, but impossible to achieve eight groups of $41$.
  • $2+3+5+\cdots+59 = 440$, but impossible to achieve eight groups of $55$.
  • $2+3+5+\cdots+67 = 568$, but impossible to achieve eight groups of $71$.
  • $2+3+5+\cdots+73 = 712$, but impossible to achieve eight groups of $89$.
  • $2+3+5+\cdots+103 = 1264$, but impossible to achieve eight groups of $158$.

For $N_8= 29$, $8$ groups of $185$ :

  • $2, 7, 13, 19, 29, 31, 37, 47$
  • $53, 61, 71$
  • $23, 73, 89$
  • $5, 83, 97$
  • $41, 43, 101$
  • $3, 79, 103$
  • $11, 67, 107$
  • $17, 59, 109$

Rohan Lewis¶

2026.03.30¶

Code can be found here.