[ Challenge :] Print all pair of prime numbers whose sum equals the number given by the user ! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 23

[ Challenge :] Print all pair of prime numbers whose sum equals the number given by the user !

(prime number is a number bigger than unity that can be divided with another number resulting modulo 0, only by itself and by unity) e.g. user gives 14, program prints: 3, 11 7, 7 (11, 7, 3 are all numbers that can be divided giving modulo 0 only by themselves or by unity)

19th Oct 2017, 1:35 PM
Nikos And
Nikos And - avatar
59 Answers
+ 26
//here is my try ... work is in progress ☺ ⬜🌹🌹🌹🌹🌹⬜ 🌹⬜⬜⬜⬜⬜⬜ 🌹⬜⬜⬜⬜⬜⬜ 🌹⬜⬜⬜🌹🌹🌹 🌹⬜⬜⬜⬜⬜🌹 🌹⬜⬜⬜⬜⬜🌹 ⬜🌹🌹🌹🌹🌹⬜ https://code.sololearn.com/czTIFjtzn23y/?ref=app
19th Oct 2017, 7:28 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
If I understood correctly with my poor English: https://code.sololearn.com/coGkC4vJr7sA/?ref=app
8th Oct 2017, 9:32 PM
Podretyz
Podretyz - avatar
9th Oct 2017, 2:46 PM
David Akhihiero
David Akhihiero - avatar
+ 9
[challenge]@all pair of prime numbers...... https://code.sololearn.com/c5FYasiEqg44/?ref=app
19th Oct 2017, 3:21 PM
SAKSHI
SAKSHI - avatar
+ 8
trying
19th Oct 2017, 1:12 PM
SAKSHI
SAKSHI - avatar
+ 8
up to any number , on C++ : https://code.sololearn.com/cI9kjnH3AC82/#cpp ( changed after Kartik Krishnan comment. now 1 and its potential Input-1 prime number will not be counted as primes)
19th Oct 2017, 1:39 PM
Nikos And
Nikos And - avatar
+ 6
Thanks for the challenge. Here's my try : https://code.sololearn.com/cyCIgLghVey3/?ref=app
9th Oct 2017, 5:44 PM
LukArToDo
LukArToDo - avatar
+ 5
https://code.sololearn.com/cwwRFceIhiRp/?ref=app
9th Oct 2017, 11:47 AM
Hiroki Masuda
Hiroki Masuda - avatar
+ 5
@mehmet oh yes... could you give a proof for that! (to be honest, I am not up to date if somone could up to now. the last exciting news in this direction were about Fermat and 4-color)
10th Oct 2017, 7:04 AM
Oma Falk
Oma Falk - avatar
+ 4
Only up to 100... but with some brain ... have fun https://code.sololearn.com/cf2OlIdiu56R/?ref=app
9th Oct 2017, 10:19 AM
Oma Falk
Oma Falk - avatar
+ 4
10th Oct 2017, 6:03 AM
Chinmoy
Chinmoy - avatar
+ 4
@Oma Falk No one has proved it for every even number, they are up to 4x10^18 though :D
10th Oct 2017, 10:12 AM
Mehmet
Mehmet - avatar
+ 4
@jonathan 2+17 =19 it it will also work with odds, if the given number is the higher one of prime twins.
11th Oct 2017, 5:43 AM
Oma Falk
Oma Falk - avatar
+ 4
@Kartik Krishnan You are right! I fixed my code and changed the explanation of the challenge. Thanks for your comment.
19th Oct 2017, 1:37 PM
Nikos And
Nikos And - avatar
19th Oct 2017, 8:00 PM
VcC
VcC - avatar
22nd Oct 2017, 1:51 AM
Petros Simidyan
Petros Simidyan - avatar
+ 4
Have tried to increase the performance (if is that possible around Python :) ) You may compare on big numbers and give you grades (my modest first try). also if 4 is the required sum, we still have one pair 2+2 = 4 I saw some of codes just skip this pair https://code.sololearn.com/ctDXKEfGDH52
22nd Oct 2017, 2:47 AM
SergK
SergK - avatar
+ 4
Here's my C++ approach - #A precise one... https://code.sololearn.com/cQyUId6T24WV/?ref=app
22nd Oct 2017, 4:07 AM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
22nd Oct 2017, 5:12 PM
Oma Falk
Oma Falk - avatar