Successive prime differences: Difference between revisions
m
C++ - renamed class
m (Minor edit to C++ code) |
m (C++ - renamed class) |
||
Line 144:
#include <cstdint>
#include <vector>
#include "
using integer = uint32_t;
Line 202:
const integer limit = 1000000;
const size_t max_group_size = 4;
diffs d[] = { {2}, {1}, {2, 2}, {2, 4}, {4, 2}, {6, 4, 2} };
vector group;
Line 221:
}</lang>
Contents of
<lang cpp>#ifndef
#define
#include <algorithm>
Line 232:
* See https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.
*/
class
public:
explicit
bool is_prime(size_t) const;
private:
Line 245:
* @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 265:
* @return true if the integer is prime
*/
inline bool
if (n == 2)
return true;
|