An idea to improve the tests for sum all primes task

An idea to improve the tests for sum all primes task
0

#1

rechecking my old (ok, from 5th january :3) solution i suddenly found that despite it passed the tests it was not completely correct

you see, after having read a short article on primes, to save the amount of calculations i’d done division checking up to the square root of the number instead of doing it up to the (number - 1), but i did the checking as strictly less than the square root rather than less or equal, so it indeed found all the primes… unless you tried to check it for a number like 121 which is divisible only by a single prime number that’s therefore its square root, so it counted that number for a prime since it never checked if it is divisible by its square root

tldr, add a number like 9, 25, 49, 121 etc to the test suit, 4 is such a number too but for instance my code had [2,3,5,7] primes already defined so it would pass it


#2

You can submit suggestions like this as a GitHub Issue. (You can also then implement them yourself and submit a PR).