primes - generate primes


primes [start [stop]]


The primes utility prints primes in ascending order, one per line, starting at or above start and continuing until, but not including stop. The start value must be at least 0 and not greater than stop. The stop value must not be greater than 4294967295. The default value of stop is 4294967295.

When the primes utility is invoked with no arguments, start is read from standard input. stop is taken to be 4294967295. The start value may be preceded by a single +. The start value is terminated by a non-digit character (such as a newline).


primes has no known bugs. The algorithm is non-optimal.


The Perl implementation of factor was originally written by Jonathan Feinberg, and modified by Benjamin Tilly,


This program is copyright (c) Jonathan Feinberg and Benjamin Tilly (1999).

This program is free and open software. You may use, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.