Strong and weak primes: Difference between revisions
m
C++ - renamed class
m (Minor edit to C++ code) |
m (C++ - renamed class) |
||
Line 309:
#include <locale>
#include <sstream>
#include "
int main() {
Line 318:
// find the prime numbers up to array_size
// write numbers with groups of digits separated according to the system default locale
Line 356:
}</lang>
Contents of
<lang cpp>#ifndef
#define
#include <algorithm>
Line 367:
* See https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.
*/
class
public:
explicit
bool is_prime(size_t) const;
private:
Line 380:
* @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 400:
* @return true if the integer is prime
*/
inline bool
if (n == 2)
return true;
|