Leap, Difference of Squares, Grains, Collatz Conjecture, Queen Attack, Darts, Hamming, and Space Age completed yesterday. Binary and Linked List completed today.
13 lines
386 B
C
13 lines
386 B
C
#ifndef SIEVE_H
|
|
#define SIEVE_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
/// Calculate at most `max_primes` prime numbers in the interval [2,limit]
|
|
/// using the Sieve of Eratosthenes and store the prime numbers in `primes`
|
|
/// in increasing order.
|
|
/// The function returns the number of calculate primes.
|
|
uint32_t sieve(uint32_t limit, uint32_t * primes, size_t max_primes);
|
|
|
|
#endif
|