YoushouldhavereceivedacopyoftheGNUGeneralPublicLicensealongwith
the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include"testutils.h"
staticint
isprime (unsignedlongint t)
{ unsignedlongint q, r, d;
if (t < 32) return (0xa08a28acUL >> t) & 1; if ((t & 1) == 0) return0;
if (t % 3 == 0) return0; if (t % 5 == 0) return0; if (t % 7 == 0) return0;
for (d = 11;;)
{
q = t / d;
r = t - q * d; if (q < d) return1; if (r == 0) break;
d += 2;
q = t / d;
r = t - q * d; if (q < d) return1; if (r == 0) break;
d += 4;
} return0;
}
staticvoid
check_one (mpz_srcptr n, int want)
{ int got;
got = mpz_probab_prime_p (n, 25);
/* "definitely prime" is fine if we only wanted "probably prime" */ if (got == 2 && want == 1)
want = 2;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.