6 ms·
For any number up to 4x10^18, the solution is less than 4 steps. Use Goldbach's conjecture to split both numbers in a sum of two primes. Go from the source to 0
by rrobukef 4y ago
For any number up to 4x10^18, the solution is less than 4 steps.
Use Goldbach's conjecture to split both numbers in a sum of two primes. Go from the source to 0, go from 0 to the target.
EDIT: Use goldbach's theorem on the difference between both numbers.
- jameshart 4y agoSadly, you are only allowed to use prime factors of the current number, not arbitrary primes.