Primorial numbers: Difference between revisions
m
C++ - renamed class
m (Minor edit to C++ code) |
m (C++ - renamed class) |
||
Line 159:
#include <sstream>
#include <gmpxx.h>
#include "
typedef mpz_class integer;
Line 173:
const size_t max_index = 1000000;
integer primorial = 1;
Line 193:
}</lang>
Contents of
<lang cpp>#ifndef
#define
#include <algorithm>
Line 204:
* See https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.
*/
class
public:
explicit
bool is_prime(size_t) const;
private:
Line 217:
* @param limit the maximum integer that can be tested for primality
*/
inline
limit = std::max(size_t(3), limit);
is_prime_.resize(limit/2, true);
Line 237:
* @return true if the integer is prime
*/
inline bool
if (n == 2)
return true;
|