]> git.ozlabs.org Git - ccan/blob - ccan/eratosthenes/_info
crypto/shachain/tools: update to new rbuf API.
[ccan] / ccan / eratosthenes / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * eratosthenes - Sieve of Eratosthenes
7  *
8  * This code implements Eratosthenes' Sieve for efficiently finding
9  * small prime numbers (in this context anything less than several
10  * billion is "small").
11  *
12  * Example:
13  *      #include <ccan/eratosthenes/eratosthenes.h>
14  *
15  *      int main(int argc, char *argv[])
16  *      {
17  *              struct eratosthenes s;
18  *              unsigned long p;
19  *
20  *              eratosthenes_init(&s);
21  *              eratosthenes_sieve(&s, atol(argv[1]));
22  *
23  *              while ((p = eratosthenes_nextprime(&s, p)) != 0) {
24  *                      printf("%ld\n", p);
25  *              }
26  *
27  *              return 0;
28  *      }
29  *
30  * License: LGPL (v2.1 or any later version)
31  * Author: David Gibson <david@gibsond.dropbear.id.au>
32  */
33 int main(int argc, char *argv[])
34 {
35         /* Expect exactly one argument */
36         if (argc != 2)
37                 return 1;
38
39         if (strcmp(argv[1], "depends") == 0) {
40                 printf("ccan/bitmap\n");
41                 return 0;
42         }
43
44         return 1;
45 }