Problem Description Link
Algorithm:
To solve this problem you can follow this technique
1. At first you need to generate prime number up to 1000000
to generate prime number you can use sieve method . this method is faster than others.
2. then get input n and
3. check for each input for i from 3 to n/2
if i and n-i both are prime then
set flag and break the loop
4. if flag set then print n = i + (n-i)
5. otherwise print "Goldbach's conjecture is wrong." without double quotation.
Algorithm:
To solve this problem you can follow this technique
1. At first you need to generate prime number up to 1000000
to generate prime number you can use sieve method . this method is faster than others.
2. then get input n and
3. check for each input for i from 3 to n/2
if i and n-i both are prime then
set flag and break the loop
4. if flag set then print n = i + (n-i)
5. otherwise print "Goldbach's conjecture is wrong." without double quotation.
No comments:
Post a Comment
Write your comment - Share Knowledge and Experience