Copyright 2000-2002, 2012, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
The GNU MP Library test suite is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
The GNU MP Library test suite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
With no arguments testing goes up to the initial value of "limit" below. With a number argument tests are carried that far, or with a literal "x" tests are continued without limit (this being meant only for development
purposes). */
int
main (int argc, char *argv[])
{ unsignedlong n, m; unsignedlong limit = 2222;
mpz_t df[2], f, r;
n = 2097169; /* a prime = 1 mod 4*/ if (n / 2 > MP_LIMB_T_MAX)
n = 131041; /* a smaller prime :-) */
mpz_fac_ui (f, n / 2); /* ((n-1)/2)! */
m = mpz_fdiv_ui (f, n); /* ((n-1)/2)! mod n*/
mpz_set_ui (f, m);
mpz_mul_ui (f, f, m); /* (((n-1)/2)!)^2 */
m = mpz_fdiv_ui (f, n); /* (((n-1)/2)!)^2 mod n*/ if ( m != n - 1)
{
printf ("mpz_fac_ui(%lu) wrong\n", n / 2);
printf (" al-Haytham's theorem not verified: got %lu, expected %lu.\n", m, n - 1);
abort ();
}
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.