0

Review My Code of Prime Number

Can i get the review of my code of prime number, in that i had checked whether the given input number is prime or not. I guess that is the fastest method to check whether the given number is prime or not. It was passed on HackerRank prime number problem. Regards Palkesh Goyal Code link: https://code.sololearn.com/ca9A23A6a10a/?ref=app

2nd Mar 2021, 1:44 PM
Palkesh Goyal
Palkesh Goyal - avatar
9 Answers
+ 4
Hello! get here is the link of Palkesh Goyal prime number code https://code.sololearn.com/ca9A23A6a10a/?ref=app Also, Palkesh, I input 1315252 big number but it showed no ouput. Maybe you can change your code a bit and handle big numbers as well so that we can judge the speed you are talking about (fastest prime checker) Thanks
2nd Mar 2021, 2:02 PM
Sharique Khan
Sharique Khan - avatar
+ 5
Now check this number - 2345673582 Palkesh Goyal
2nd Mar 2021, 2:11 PM
Sharique Khan
Sharique Khan - avatar
+ 4
😁 Palkesh Goyal you got your review now work on it Happy Coding đŸ€ŸđŸ»
2nd Mar 2021, 2:15 PM
Sharique Khan
Sharique Khan - avatar
+ 2
Tips: 1) Your algorithm checks if number is pseudo-prime ("there is a possibility that this number is prime". For example, is says that 49 is prime (49 = 7 * 7). 2) The best way is the one that gives output in the SoloLearn C++ Playground for numbers upto 2147483647 (the highest possible number for <int> (4 bytes/32 bits). You can try to find that way, but not sure if such a way even exists.
2nd Mar 2021, 2:25 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
@Sharique Khan, i just put the number you mentioned and it gives the output Can you please review it once again, if you have time. Thanks for reviewing my code
2nd Mar 2021, 2:06 PM
Palkesh Goyal
Palkesh Goyal - avatar
+ 1
I will try to resolve the issue, and yeah 49 doesn't work in my logic, that is a loop whole in code. Thnx for reviewing my code get
2nd Mar 2021, 2:29 PM
Palkesh Goyal
Palkesh Goyal - avatar
0
Hello, can you, please, give the link to your code in SoloLearn or paste the code here, so that we would be able to review your code?
2nd Mar 2021, 1:46 PM
#0009e7 [get]
#0009e7 [get] - avatar
0
Yeah, now its not working @Sharique Khan,
2nd Mar 2021, 2:13 PM
Palkesh Goyal
Palkesh Goyal - avatar
0
Yeah, thanx for your review @Sharique Khan
2nd Mar 2021, 2:15 PM
Palkesh Goyal
Palkesh Goyal - avatar