Solution to Project Euler Problem 46: Goldbach's other conjecture - It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square. 9 = 7 + 2×12 15 = 7 + 2×22 21 = 3 + 2×32 25 = 7 + 2×32 27 = 19 + 2×22 33 = 31 + 2×12 It turns out that the conjecture was false. What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?


Updated: July 24, 2021 — Training Time: 3 minutes
Overseen by: Archangel Macsika
All Training Resources

Scroll for more menu list

Topic: Project Euler Problem 46: Goldbach's other conjecture.

Difficulty: Easy.

Objective: It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.
9 = 7 + 2×12
15 = 7 + 2×22
21 = 3 + 2×32
25 = 7 + 2×32
27 = 19 + 2×22
33 = 31 + 2×12
It turns out that the conjecture was false.
What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?

Input: None.

Expected Output: 5777.

Sikademy Solution in Java Programming Language

Sikademy Solution in Python Programming Language

Was this training resource helpful?