---
name: "primes"
section: "6"
platform: "linux"
package: "bsdgames"
version: "2.17-35"
release: "Debian 13 (Trixie)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/primes/6"
---

# primes(6)

generate primes

## NAME

**primes** – generate primes

## SYNOPSIS

**primes** \[**-dh**\] \[*start* \[*stop*\]\]

## DESCRIPTION

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 3825123056546413050. The default value of *stop* is 3825123056546413050.

When the **primes** utility is invoked with no arguments, *start* is read from standard input and *stop* is taken to be 3825123056546413050. The *start* value may be preceded by a single ‘+’. The *start* value is terminated by a non-digit character (such as a newline). The input line must not be longer than 255 characters.

When given the **-d** argument, **primes** prints the difference between the current and the previous prime.

When given the **-h** argument, **primes** prints the prime numbers in hexadecimal.

## DIAGNOSTICS

Out of range or invalid input results in an appropriate error message to standard error.

## AUTHORS

Originally by Landon Curt Noll, extended to some 64-bit primes by Colin Percival.

## BUGS

This **primes** program won't get you a world record.
