A program to test Golbach conjecture for a given integer:
This program demonstrates two algorithms that are well known.
- The sieve of Eratosthenes to calculate all primes upto a given number
- A linear algorithm to find if two numbers in a list sum to a given number.
To prove the Goldbach conjecture for a given n, we use the sieve to find all prime numbers up to n, then use the linear algorithm to find two primes from this list that sums up to n.
No comments:
Post a Comment