First D algorithm stuff from <http://dx.doi.org/10.1090/S0025-5718-1980-0583518-6> - if the Jacobi (D/n) is 0, D is a factor of n.
A simple prime-number bot, in python for mastodon/the fediverse.