# RandomSafePrime

Compute one or more safe primes in a requested range

ResourceFunction["RandomSafePrime"][ gives a safe prime equal or less than | |

ResourceFunction["RandomSafePrime"][{ gives a safe prime in the range | |

ResourceFunction["RandomSafePrime"][ gives |

## Details and Options

ResourceFunction["RandomSafePrime"] uses RandomPrime to generate candidate safe primes. Generating the requested number of safe primes may take a significant amount of time. Ranges which contain no safe primes will eventually time out.

RandomSafePrime will time out after 60 seconds. This time-out can be modfied with the TimeConstraint option.

## Examples

### Basic Examples

Generate a random safe prime:

In[1]:= |

Out[1]= |

Check that it is indeed a safe prime:

In[2]:= |

Out[2]= |

Generate several safe primes:

In[3]:= |

Out[3]= |

Check that they are safe primes:

In[4]:= |

Out[4]= |

### Scope

Generate a safe prime in a specific range:

In[5]:= |

Out[5]= |

Generate several safe primes in a specific range:

In[6]:= |

Out[6]= |

### Options

Attempting to generate a large number of safe primes in a small amount of time will time out:

In[7]:= |

Out[7]= |