Fix is-prime to work with inputs < 2.
Solution for p39.
Solution for p40.
Solution for p41.