+ 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
3 Respuestas
+ 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.
+ 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