-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <assert.h> | ||
#include <stddef.h> | ||
|
||
struct SieveOfEratosthenes; | ||
struct SieveOfEratosthenes *sieve_of_eratosthenes_new(size_t limit); | ||
size_t sieve_of_eratosthenes_count(struct SieveOfEratosthenes *erato); | ||
void sieve_of_eratosthenes_delete(struct SieveOfEratosthenes *erato); | ||
|
||
struct SieveOfAtkin; | ||
struct SieveOfAtkin *sieve_of_atkin_new(size_t limit); | ||
size_t sieve_of_atkin_count(struct SieveOfAtkin *atkin); | ||
void sieve_of_atkin_delete(struct SieveOfAtkin *atkin); | ||
|
||
int | ||
main(void) | ||
{ | ||
struct SieveOfEratosthenes *erato = sieve_of_eratosthenes_new(1000000000); | ||
size_t erato_count = sieve_of_eratosthenes_count(erato); | ||
sieve_of_eratosthenes_delete(erato); | ||
assert(erato_count == 50847531); | ||
|
||
struct SieveOfAtkin *atkin = sieve_of_atkin_new(1000000000); | ||
size_t atkin_count = sieve_of_atkin_count(atkin); | ||
sieve_of_eratosthenes_delete(erato); | ||
assert(atkin_count == 50847531); | ||
} |