Number theory problem

Revision en1, by MohamedHassan499, 2020-02-10 01:41:38

You're given a number $$$n$$$ It's required from you to get 4 positive prime numbers at which their summition equals to $$$n$$$, and if this isn't possible, then state that (There's more that one test cast BTW).

My approach was to get all prime numbers form 2 to 10000000 using sieve theory only once, and to try assume 3 of these numbers and get every possible combination of 2's and 3's (Assuming that all prime numbers can be deduce from summition of these two) let these numbers are $$$x$$$, $$$y$$$ and $$$z$$$ and if there exist a fourth number at which this 4th number = n - x + y + z and If it's positive and prime, then we found the answer otherwise this won't be possible.

If there's something wrong with my approach? If not there's the mistake in my code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English MohamedHassan499 2020-02-10 01:43:58 23 Tiny change: 'r **$n$** which's prime, It's req' -> 'r **$n$** It may be prime or not, It's req'
en2 English MohamedHassan499 2020-02-10 01:42:40 129
en1 English MohamedHassan499 2020-02-10 01:41:38 841 Initial revision (published)