+ 8

Challenge : The Prime Search!!! (Hard)

primes are positive integers that on have 2 divisors : 1 and itseft. input any prime/es and make a code that looks for the nearest prime/es example : 4 5 8 43 => 5 5 7 43 good luck

10th Aug 2017, 11:55 AM
Domces Games
Domces Games - avatar
11 Answers
+ 2
https://code.sololearn.com/cOOJQn2Fc9V6/#cpp input numbers range 1~ 1000,000 you can input many numbers at one time
10th Aug 2017, 2:36 PM
ꇵꇂ蔔
ꇵꇂ蔔 - avatar
+ 2
Took some time to locate my dumb mistake but here it is: https://code.sololearn.com/cW8cs3956os2/?ref=app
10th Aug 2017, 3:08 PM
Abdelfattah Toulaoui
Abdelfattah Toulaoui - avatar
+ 2
can someone do one in java please?
11th Aug 2017, 11:19 PM
Shedrick Williams
Shedrick Williams - avatar
+ 2
Here is my try for this challenge. You put in 1 number and it returns the nearest prime number: please leave an upvote if you like it :) https://code.sololearn.com/cPoYdUAD0aKV/#cpp https://code.sololearn.com/cmnR7IPOF1G0/#cs
16th Aug 2017, 3:44 PM
Damian Atłasik
Damian Atłasik - avatar
+ 1
https://code.sololearn.com/cEv0c8jcOpD9/?ref=app
10th Aug 2017, 1:27 PM
Slak
Slak - avatar
+ 1
It works with one number but not with multiple (don't know why): https://code.sololearn.com/WOI5RS4WWE9V/?ref=app
10th Aug 2017, 7:48 PM
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e - avatar
+ 1
Here is my try. Only one input per run, finds the nearest prime. Also the occasion where your input is at same distance to primes like 3-4-5 and the occasion where your input is already prime are included in the code. https://code.sololearn.com/WbhTGO7SCxg1/#js
11th Aug 2017, 10:09 AM
Mehmet
Mehmet - avatar
0
Rectification, this one is working now, the last one that I post, the prime number function was not completely working: https://code.sololearn.com/WQKP52MVKYEs/?ref=app
12th Aug 2017, 8:53 AM
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e - avatar
12th Aug 2017, 5:09 PM
Darek554
Darek554 - avatar
0
My last version (you can put 400000,it still works) : https://code.sololearn.com/WqYmHv3po8z9/?ref=app
14th Aug 2017, 11:13 AM
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e
Ī‘Ī·Ļ„ĪæĪ¹Ļ€e - avatar