#include <cmath>
#include "misc/prime.h"
#include "factory/cf_primes.h"
Go to the source code of this file.
◆ iiIsPrime0()
static int iiIsPrime0 |
( |
unsigned |
p | ) |
|
|
static |
Definition at line 12 of file prime.cc.
13{
16 {
17 int a=0;
20 do
21 {
27 } while ( a<= e);
30 }
32 unsigned end_p=(unsigned)
sqrt((
double)
p);
33restart:
34 for (
i=0;
i<end_i;
i++)
35 {
38 {
41 goto restart;
42 }
43 if (
j > end_p)
return p;
44 }
46 {
48 {
51 {
54 goto restart;
55 }
56 }
57 }
59}
int cf_getNumSmallPrimes()
int cf_getSmallPrime(int i)
gmp_float sqrt(const gmp_float &a)
static int iiIsPrime0(unsigned p)
◆ IsPrime()
Definition at line 61 of file prime.cc.
62{
64 else if (
p == 1)
return 1;
65 else if ((
p == 2)||(
p==3))
return p;
66 else if (
p < 0)
return 2;
69}