Random Primes

## Description

The command `random_prime(a)` generates a random prime between 2 and $a$. The command `random_prime(a, proof=True)` will generate a random prime number between 2 and $a$. Replacing `proof=True` by `proof=False` will speed up the search, but there will be a very, very, very small probability the result will not be prime. The default is `proof=True`, but this should be checked by executing

```
from sage.structure.proof.proof import get_flag
get_flag()
```

## Sage Cell

## Options

```
a = random_prime(10^21, proof=True)
a
```

## Tags

Primary Tags: number theory

Secondary Tags: primes

## Related Cells

- The Modulus Operator
- The Quotient-Remainder Method
- The Divides Method
- The Greatest Common Divisor Command
- The Extended Greatest Common Divisor Command
- The Is-Prime Method
- The Prime Range Command
- The Next Prime Command
- The Previous Prime Command
- The Factor Command

## Attribute

Permalink: http://abstract.ups.edu/aata/integers-sage.html

Author: R. Beezer

Date: 15 Jul 2017 08:32

Submitted by: Tom Judson