-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprimes.hpp
More file actions
39 lines (30 loc) · 994 Bytes
/
Copy pathprimes.hpp
File metadata and controls
39 lines (30 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#if !defined(PRIMES)
#define PRIMES
#include <random.hpp>
#include <vector>
#include <cstdint>
namespace nm {
template<typename T>
std::vector<T> eratosthenes_sieve(const T n);
} // primes
namespace nm {
const std::uint32_t RAMANUJAN_NUMBER = 1729; // smallest
const std::uint32_t CARMICHAEL_NUMBER = 561; // smallest
const std::uint32_t SMALLEST_PERFECT = 6;
const std::uint32_t SMALLEST_HAPPY = 7;
class Primality {
private:
std::uint32_t i;
Random random;
protected:
std::uint32_t trivial(std::uint32_t number);
public:
Primality(std::uint32_t iterations = SMALLEST_HAPPY);
~Primality() {};
bool fermat(std::uint64_t number);
bool miller_rabin(std::uint32_t number);
bool solovay_strassen(std::uint32_t number);
bool agarwal_kayal_saxena(std::uint64_t number);
};
} // primality tests
#endif // PRIMES