Ponder This Challenge - March 2026 - Path game on a hole-riddled chessboard
- Ponder This
This puzzle was suggested by Giorgos Kalogeropoulos - thanks!
Given a natural number 𝑛, take the first 𝑛 odd primes (3, 5, 7, 11, …) and the first 𝑛 positive even integers (2, 4, …, 2𝑛).
Compute all possible pairwise sums between these two sets (𝑛² sums in total, all odd).
We denote by 𝑓(𝑛) the number of these sums that are prime. For example, 𝑓(5) = 16.
Your goal: Find 𝑓(10⁸).
A bonus "*" will be given for finding 𝑓(10⁹).
The numerical solutions are
ƒ(1⨀^8) = 972989871151789
ƒ(1⨀^9) = 871⨀51873756928⨀5
This riddle was pretty straightforward, and the challenge was in writing an efficient implementation. For the primes, a standard sieve could be used to obtain them. For the sums, we received solutions describing them as convolutions and using Fourier transform techniques which is a nice way to consider this problem.