Successive prime differences: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) →{{header|Raku}}: fix up internal link |
m Put Sieve of Eratosthenes implementation in separate header file |
||
Line 144: | Line 144: | ||
#include <cstdint> |
#include <cstdint> |
||
#include <vector> |
#include <vector> |
||
⚫ | |||
using integer = uint32_t; |
using integer = uint32_t; |
||
using vector = std::vector<integer>; |
using vector = std::vector<integer>; |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
void print_vector(const vector& vec) { |
void print_vector(const vector& vec) { |
||
Line 240: | Line 220: | ||
return 0; |
return 0; |
||
}</lang> |
}</lang> |
||
Contents of sieve_of_eratosthenes.h: |
|||
<lang cpp>#ifndef SIEVE_OF_ERATOSTHENES_H |
|||
#define SIEVE_OF_ERATOSTHENES_H |
|||
#include <vector> |
|||
class sieve_of_eratosthenes |
|||
{ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
inline bool sieve_of_eratosthenes::is_prime(size_t n) const |
|||
{ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
#endif</lang> |
|||
{{out}} |
{{out}} |