Puzzle
2 minute read

Ponder This Challenge - December 2025 - Sums of a prime and an even number

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⁹).

Solution

  • 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.

Solvers

*Lazar Ilic(1/12/2025 2:51 PM IST)
*Jiri Spitalsky(1/12/2025 4:34 PM IST)
*Daniel Chong Jyh Tar(1/12/2025 4:39 PM IST)
*Dan Dima(1/12/2025 4:45 PM IST)
Ahmet Yuksel(1/12/2025 6:37 PM IST)
*Bertram Felgenhauer(1/12/2025 8:07 PM IST)
*Hongcheng Zhu(1/12/2025 9:35 PM IST)
*Nadir S.(1/12/2025 10:35 PM IST)
*Prashant Wankhede(1/12/2025 11:40 PM IST)
*King Pig(2/12/2025 12:30 AM IST)
*Stephen Ebert(2/12/2025 12:37 AM IST)
*Sanandan Swaminathan(2/12/2025 1:20 AM IST)
*Naftali Peles(2/12/2025 2:09 AM IST)
*Alper Halbutogullari(2/12/2025 2:42 AM IST)
*Guangxi Liu(2/12/2025 4:42 AM IST)
*Bert Dobbelaere(2/12/2025 9:38 AM IST)
Reiner Martin(2/12/2025 12:20 PM IST)
Stéphane Higueret(2/12/2025 1:03 PM IST)
*Vladimir Volevich(2/12/2025 1:42 PM IST)
*Daniel Bitin(2/12/2025 2:37 PM IST)
*Karl-Heinz Hofmann(2/12/2025 5:19 PM IST)
*Shirish Chinchalkar(2/12/2025 5:51 PM IST)
*Latchezar Christov(2/12/2025 6:02 PM IST)
*Ankit Aggarwal(2/12/2025 8:07 PM IST)
*Paul Lupascu(2/12/2025 8:24 PM IST)
*Arthur Vause(2/12/2025 8:49 PM IST)
*James Pepper(2/12/2025 10:14 PM IST)
Lorenz Reichel(2/12/2025 10:41 PM IST)
*Martin Thorne(3/12/2025 12:24 AM IST)
*David F.H. Dunkley(3/12/2025 1:56 AM IST)
Gary M. Gerken(3/12/2025 10:37 AM IST)
*Sergey Batalov(3/12/2025 11:29 AM IST)
*Loukas Sidiropoulos(3/12/2025 4:08 PM IST)
*Juergen Koehl(3/12/2025 6:08 PM IST)
*Lorenzo Gianferrari Pini(3/12/2025 6:10 PM IST)
Paul Shaw(3/12/2025 7:02 PM IST)
*Kang Jin Cho(4/12/2025 7:34 AM IST)
*Dieter Beckerle(4/12/2025 8:24 AM IST)
Fabio Michele Negroni(4/12/2025 12:18 PM IST)
*Dominik Reichl(4/12/2025 6:33 PM IST)
*Hugo Pfoertner(4/12/2025 7:33 PM IST)
Amos Guler(4/12/2025 8:46 PM IST)
*Özgür Soysal(5/12/2025 9:04 AM IST)
*Michael Vahle(5/12/2025 4:40 PM IST)
*Mitja Devetak(5/12/2025 6:14 PM IST)
*John Spurgeon(6/12/2025 7:16 AM IST)
*Titos Betsos(6/12/2025 5:16 PM IST)
*Eran Vered(6/12/2025 10:53 PM IST)
*Liubing Yu(7/12/2025 3:52 AM IST)
*Peter Jin(7/12/2025 7:17 AM IST)
*Prakhar Kapoor(7/12/2025 12:24 PM IST)
Michael Liepelt(7/12/2025 7:46 PM IST)
Alex Fleischer(7/12/2025 9:17:00 PM IST)
*Chris Shannon(7/12/2025 11:42 PM IST)
*Michael Ott(8/12/2025 3:40 AM IST)
*Shouky Dan & Tamir Ganor(8/12/2025 10:21 AM IST)
*Wyatt Daviau(8/12/2025 6:27 PM IST)
*José Eduardo Gaboardi de Carvalho(8/12/2025 9:29 PM IST)
*Gürkan Koray Akpınar(10/12/2025 9:19 PM IST)
Yanrui (Kevin) Li(11/12/2025 4:03 AM IST)
*Guillaume Dujardin(11/12/2025 12:36 PM IST)
Piyush Agrawal(11/12/2025 2:37 PM IST)
*Laurent Desnogues(11/12/2025 7:09 PM IST)
*Nyles Heise(12/12/2025 6:08 AM IST)
*Hansraj Nahata & Govind Jujare(13/12/2025 4:12 AM IST)
*Joaquim Carrapa(13/12/2025 5:38 PM IST)
*Viplov Jain(14/12/2025 12:57 AM IST)

Related posts