Home | History | Annotate | Download | only in primes

Lines Matching refs:start

55  *	primes [-dh] [start [stop]]
57 * Print primes >= start and < stop. If stop is omitted,
58 * the value SPSPMAX is assumed. If start is
59 * omitted, start is read from standard input.
100 uint64_t start; /* where to start generating */
120 start = 0;
131 /* Start and stop supplied on the command line. */
136 start = strtoumax(argv[0], &p, 0);
150 /* Start on the command line. */
155 start = strtoumax(argv[0], &p, 0);
162 start = read_num_buf();
168 if (start > stop)
169 errx(1, "start value must be less than stop value.");
170 primes(start, stop);
206 * primes - sieve and print primes from start up to and but not including stop
209 primes(uint64_t start, uint64_t stop)
224 if (start < 3) {
225 start = 2;
230 if (stop <= start) {
237 if (start != 2 && (start&0x1) == 0) {
238 ++start;
247 if (start <= *pr_limit) {
248 /* skip primes up to the start value */
251 if (factor >= start) {
264 start = *pr_limit+2;
271 while (start < stop) {
276 factor = (start%(2*3*5*7*11*13))/2; /* starting copy spot */
290 if (stop-start > TABSIZE+TABSIZE) {
292 fact_lim = sqrt(start+1.0+TABSIZE+TABSIZE);
294 tab_lim = &table[(stop-start)/2]; /* partial sieve */
302 mod = start%factor;
318 for (q = table; q < tab_lim; ++q, start+=2) {
320 if (start > SIEVEMAX) {
321 if (!isprime(start))
324 printf(hflag ? "%" PRIx64 : "%" PRIu64, start);
325 if (dflag && (prev || (start <= *pr_limit))) {
326 printf(" (%" PRIu64 ")", start - prev);
329 prev = start;
338 (void)fprintf(stderr, "usage: primes [-dh] [start [stop]]\n");