Repeating Goldbachs
Time limit2sMemory limit512 MB
Apply the largest-difference Goldbach step to an even x under 1,000,000 until it drops below 3, and count the steps.
- Level
Medium7 of 10
- Topics
- Number theory, Simulation, Math, Brute force
- Solved
- No attempts yet
Problem
The Goldbach Conjecture states that any even number greater than 3 can be expressed as the sum of two primes (primes are numbers that have exactly two factors: themselves and 1). It has never been proven for all even numbers, but it has been demonstrated to be true for all of the numbers that we will use for this problem.
Consider any even integer . There may be many pairs of primes which sum to . Take the pair with the largest difference. That difference must be even, and less than . So, repeat the trick. How many steps does it take until you reach an even number less than 3 (2 or 0)?
Input
Each input will consist of a single test case. Note that your program may be run multiple times on different inputs.
Each test case will consist of a single line with a single integer (, is even).
Output
Output a single integer, which is the count of Repeating Goldbach steps until the number is less than 3.