3 ms·
Let me repeat if I understand it right: * The function will return True for all primes. * The function will return False if the number is detected as a compos
by threatripper 4y ago
Let me repeat if I understand it right:
* The function will return True for all primes.
* The function will return False if the number is detected as a composite by some tests.
* The function can return True or False for all other numbers.
* For numbers<=23 they implemented a shortcut using a lookup table which is implemented as bits in a number.
* The bit for number 19 is wrong. It returns false for a prime number which violates "return True for all prime numbers".
This is indeed quite shoddy programming for such an essential and easily testable piece of software.
- vmilner 4y agoIt’s not easily testable if it’a pseudocode that hasn’t been implemented yet.