kitfre/OCaml-Primes

23, 29, 31 .... are not primes anymore ?

Closed this issue · 3 comments

'is_prime' seems working only for 2-3-5-7-11-13-17 and 19
(23 -> false - therefore 'prime-factors 23' gives the wrong list [] ). Interesting !

Note 1 : please don't use Core for the only '~f:' syntax. This is crazy :)
You can have the same result with the (one and only) OCaml Standard Library by writing
'ListLabels.filter ...' or 'ListLabels.map ...'.
(Suppress Core but add 'Gen' as dependency in your README.md file)

Note 2 : your source code is ugly: lot of useless whitespaces and a bad
indentation. (I suggest 'opam install ocp-indent'. ocp-indent can be integrated in your editor
or can be used as a separate program)

Thanks for the feedback! I've fixed the is_prime function, it was overflowing and causing the test to fail. I've added a metho big_is_prime which uses Zarith nums and changed is_prime to rely on that method. I'm not sure how the indentation got all whacky but thanks for pointing me towards ocp-indent that fixed it right up. And I've also removed the core dependency, the new version should be up on opam soon!

Aaaah. 23, 29, 31 ... are prime numbers. Thank you for the confirmation :)
(There is still a 'core' reference in your META file)

Good catch, thanks!