version 1.1.1.1, 2000/09/09 14:12:55 |
version 1.1.1.2, 2003/08/25 16:06:33 |
|
|
/* mpz_nextprime(p,t) - compute the next prime > t and store that in p. |
/* mpz_nextprime(p,t) - compute the next prime > t and store that in p. |
|
|
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright 1999, 2000, 2001 Free Software Foundation, Inc. |
|
|
This file is part of the GNU MP Library. |
This file is part of the GNU MP Library. |
|
|
Line 23 MA 02111-1307, USA. */ |
|
Line 23 MA 02111-1307, USA. */ |
|
#include "gmp-impl.h" |
#include "gmp-impl.h" |
|
|
void |
void |
#if __STDC__ |
|
mpz_nextprime (mpz_ptr p, mpz_srcptr t) |
mpz_nextprime (mpz_ptr p, mpz_srcptr t) |
#else |
|
mpz_nextprime (p, t) |
|
mpz_ptr p; |
|
mpz_srcptr t; |
|
#endif |
|
{ |
{ |
mpz_add_ui (p, t, 1L); |
mpz_add_ui (p, t, 1L); |
while (! mpz_probab_prime_p (p, 5)) |
while (! mpz_probab_prime_p (p, 5)) |
Line 37 mpz_nextprime (p, t) |
|
Line 31 mpz_nextprime (p, t) |
|
} |
} |
|
|
#if 0 |
#if 0 |
/* This code is not yet tested. Will be enabled in 3.1. */ |
/* This code is not yet tested. Will be enabled some time. */ |
|
|
status unsigned short primes[] = |
status unsigned short primes[] = |
{ |
{ |
Line 56 status unsigned short primes[] = |
|
Line 50 status unsigned short primes[] = |
|
#define NUMBER_OF_PRIMES 167 |
#define NUMBER_OF_PRIMES 167 |
|
|
void |
void |
#if __STDC__ |
|
mpz_nextprime (mpz_ptr p, mpz_srcptr n) |
mpz_nextprime (mpz_ptr p, mpz_srcptr n) |
#else |
|
mpz_nextprime (p, n) |
|
mpz_ptr p; |
|
mpz_srcptr n; |
|
#endif |
|
{ |
{ |
mpz_t tmp; |
mpz_t tmp; |
unsigned short *moduli; |
unsigned short *moduli; |