+ 2

Yet another primeChecker

Hi folks, I tried a primeChecker in Python https://code.sololearn.com/cpJjnEGubM5d The idea is a very little different: - it is enough to check devisors up to sqrt(Primecandidate) - it is enough to only check primes as possible devisors I begin with the first 4 primes (primeCells) - are they devisors of Candidate? - otherwise the pimeCells generate more primes as possible devisors You think, it makes sense to go this way? Also I am blind for testing now - please help to find some errors

11th Oct 2017, 11:19 AM
Oma Falk
Oma Falk - avatar
3 Answers
+ 8
@Oma tested your code with these values Number Prime factorization Divisors 23 23 1, 23 24 2^3*3 1,2,3,4,6,8,12,24 I tried with these two combinations Yes 23 is prime And 24 is non prime. But number of divisors is printed as 2 which does not match with values in above table. But the prime factors are two i.e. 2 and 3.
11th Oct 2017, 11:33 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
11th Oct 2017, 3:56 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
@apoorva thanks for testing The prog stops when it finds first devisor and prints that devisor as proof of no prime. I improved output
11th Oct 2017, 12:00 PM
Oma Falk
Oma Falk - avatar