Lines Matching +full:n +full:- +full:factor

34  * primes - generate a table of primes between two values
38 * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
41 * primes [-h] [start [stop]]
44 * the value 18446744073709551615 (2^64-1) is assumed. If
69 * odd. If the base of table is 1, table[i] represents 2*i-1. After the
70 * sieve, table[i] == 1 if and only if 2*i-1 is prime.
94 while ((ch = getopt(argc, argv, "h")) != -1) in main()
103 argc -= optind; in main()
107 stop = (uint64_t)(-1); in main()
118 if (argv[0][0] == '-' || argv[1][0] == '-') in main()
137 if (argv[0][0] == '-') in main()
161 * read_num_buf --
162 * This routine returns a number n, where 0 <= n && n <= BIG.
177 if (*p == '\n' || *p == '\0') in read_num_buf()
179 if (*p == '-') in read_num_buf()
185 if (*p != '\n') in read_num_buf()
192 * primes - sieve and print primes from start up to and but not including stop
198 ubig factor; /* index and factor */ in primes() local
234 for (p = &prime[0], factor = prime[0]; in primes()
235 factor < stop && p <= pr_limit; factor = *(++p)) { in primes()
236 if (factor >= start) { in primes()
237 printf(hflag ? "%" PRIx64 "\n" : "%" PRIu64 "\n", factor); in primes()
257 * factor out 3, 5, 7, 11 and 13 in primes()
260 factor = (start%(2*3*5*7*11*13))/2; /* starting copy spot */ in primes()
261 memcpy(table, &pattern[factor], pattern_size-factor); in primes()
263 for (fact_lim=pattern_size-factor; in primes()
268 memcpy(&table[fact_lim], pattern, TABSIZE-fact_lim); in primes()
273 /* note highest useful factor and sieve spot */ in primes()
274 if (stop-start > TABSIZE+TABSIZE) { in primes()
278 tab_lim = &table[(stop-start)/2]; /* partial sieve */ in primes()
282 factor = 17; /* 17 is first prime to use */ in primes()
285 /* determine the factor's initial sieve point */ in primes()
286 mod = start%factor; in primes()
288 q = &table[(factor-mod)/2]; in primes()
290 q = &table[mod ? factor-(mod/2) : 0]; in primes()
292 /* sieve for our current factor */ in primes()
293 for ( ; q < tab_lim; q += factor) { in primes()
299 factor = *p++; in primes()
300 } while (factor <= fact_lim); in primes()
311 printf(hflag ? "%" PRIx64 "\n" : "%" PRIu64 "\n", start); in primes()
320 fprintf(stderr, "usage: primes [-h] [start [stop]]\n"); in usage()