Skip to content

Instantly share code, notes, and snippets.

@kimwalisch
Last active August 16, 2016 20:17
Show Gist options
  • Select an option

  • Save kimwalisch/92019ba15e4dee253f4b06ab178e18db to your computer and use it in GitHub Desktop.

Select an option

Save kimwalisch/92019ba15e4dee253f4b06ab178e18db to your computer and use it in GitHub Desktop.
primesieve_iterator C example
#include <primesieve.h>
#include <stdio.h>
int main()
{
primesieve_iterator it;
primesieve_init(&it);
uint64_t prime;
/* iterate over the primes below 10^6 */
while ((prime = primesieve_next_prime(&it)) < 1000000)
printf("%llu\n", prime);
primesieve_free_iterator(&it);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment