Get Random Prime (Free)

Returns a random prime number and associated data, including base conversions, prime density, birth certificate, and more! Includes options for detailed explanations and prime types!
GET get-random-prime (free)
http://api.prime-numbers.io/get-random-prime.php?key=YOUR_API_KEY&include_explanations=<boolean>&include_prime_types_list=<boolean>&language=<string>
AUTHORIZATION API Key
This request is using the API Key from Prime Numbers API collection in thePime Numbers API environment
PARAMS
key |
YOUR_API_KEY
(Required) your API key |
include_explanations |
<boolean>
includes the full explanations for each item if true (default is false) |
include_prime_types_list |
<boolean>
includes the full prime types list for each item if true (default is false) |
language |
<string>
show the output translated into that language (it can be english, mandarin, hindi, spanish, french, german, italian, japanese, russian) (default is english) |
Success (no query params)
200 OK
{
"random_prime_number_value": 107961340891,
"base_conversions": {
"binary_value": "1100100100010111111110101001111011011",
"senary_value": "121332522114351",
"hexa_value": "1922ff53db"
},
"previous_prime_gap": 114,
"prime_density": "3.91840000",
"isolated_primes": {
"is_isolated_prime": "false",
"isolated_prime_density": "3.91840000"
},
"birth_certificate": "2021-05-02 16:09:32: server walle processed 328 575 computations in 5.476245187956 micro-seconds using 2 x 3 GHz Deca-Core Intel Xeon CPUs"
}
Success (with explanations and prime_types)
200 OK
{
"random_prime_number_value": 28217998997,
"base_conversions": {
"binary_value": "11010010001111011000111111010010101",
"binary_value_explanation": "prime number base-2 (binary value), useful for cryptography and cryptocurrency",
"senary_value": "20544013352125",
"senary_value_explanation": "prime number base-6 (senary value), useful for mathematical research",
"hexa_value": "691ec7e95",
"hexa_value_explanation": "prime number base-16 (hexa value), useful for cryptography and cryptocurrency"
},
"previous_prime_gap": 114,
"previous_prime_gap_explanation": "how many successive prime and composite numbers are between this prime and the previous one",
"prime_density": "4.16750000",
"prime_density_explanation": "how many prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"isolated_primes": {
"is_isolated_prime": "false",
"is_isolated_prime_explanation": "prime numbers that are more than 100 composite numbers away from each of their neighbours, with an average density of 0.008086097174%",
"isolated_prime_density": "4.16750000",
"isolated_prime_density_explanation": "how many chances (%) to randomly find an isolated prime number in this million composite numbers (between 28 217 000 000 and 28 218 000 000)"
},
"prime_types": {
"is_palindrome": "false",
"palindrome_explanation": "number that is simultaneously palindromic (which reads the same backwards as forwards) and prime (examples: 2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929) (reference: https://en.wikipedia.org/wiki/Palindromic_prime)",
"palindrome_percentage": "0.00000000",
"palindrome_density_explanation": "how many palindrome prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_twin": "true",
"twin_value": 28217998999,
"twin_explanation": "primes that are no more than 2 composite numbers from each other (examples: (3, 5), (5, 7), (11, 13), (17, 19)) (reference: https://en.wikipedia.org/wiki/Twin_prime)",
"twin_percentage": "0.46220000",
"twin_density_explanation": "how many twin prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_cousin": "false",
"cousin_explanation": "primes that are no more than 4 composite numbers from each other (examples: (3, 7), (7, 11), (13, 17), (19, 23), (37, 41), (43, 47)) (reference: https://en.wikipedia.org/wiki/Cousin_prime)",
"cousin_percentage": "0.46240000",
"cousin_density_explanation": "how many cousin prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_sexy": "false",
"sexy_explanation": "primes that are no more than 6 composite numbers from each other (examples: (5,11), (7,13), (11,17), (13,19), (17,23), (23,29)) (reference: https://en.wikipedia.org/wiki/Sexy_prime)",
"sexy_percentage": "0.81610000",
"sexy_density_explanation": "how many sexy prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_reversible": "false",
"reversible_explanation": "primes that become a different prime when their decimal digits are reversed. The name emirp is obtained by reversing the word prime (examples: 13, 17, 31, 37, 71, 73, 79, 97, 107, 113, 149, 157) (reference: https://en.wikipedia.org/wiki/Emirp)",
"reversible_percentage": "0.00000000",
"reversible_density_explanation": "how many reversible prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_pandigital": "false",
"pandigital_explanation": "pandigital prime in a base has at least one instance of each base digit. (examples: 2143 (base 4), 7654321 (base 7)) (reference: https://www.xarg.org/puzzle/project-euler/problem-41/)",
"pandigital_percentage": "0.00000000",
"pandigital_density_explanation": "how many pandigital prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_repunit": "false",
"repunit_explanation": "repunits primes are positive integers in which every digit is one (examples: 11, 1111111111111111111) (reference: https://primes.utm.edu/glossary/page.php?sort=Repunit)",
"repunit_percentage": "0.00000000",
"repunit_density_explanation": "how many repunit prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_mersenne": "false",
"mersenne_explanation": "mersenne prime is a prime number that is of the form 2n - 1 (one less than a power of two) for some integer n. They are named after Marin Mersenne (1588-1648), a French monk who studied them in his Cogitata Physica-Mathematica (1644) (examples: 3 (2^2 - 1), 7 (2^3 - 1), 31 (2^5 - 1) ) (reference: https://www.mersenne.org/)",
"mersenne_percentage": "0.00000000",
"mersenne_density_explanation": "how many mersenne prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)",
"is_fibonacci": "false",
"fibonacci_explanation": "prime numbers that are also Fibonacci numbers (examples: 2, 3, 5, 13, 89, 233, 1597) (reference: https://oeis.org/A005478)",
"fibonacci_percentage": "0.00000000",
"fibonacci_density_explanation": "how many fibonacci prime numbers (%) can be found in this million composite numbers (between 28 217 000 000 and 28 218 000 000)"
},
"birth_certificate": "2019-06-07 14:44:46: server mac-server processed 167 982 computations in 6.9992557884402 micro-seconds using 2 x 3 GHz Quad-Core Intel Xeon CPUs",
"birth_certificate_explanation": "how many computations, how much time and what computer power was used to find this prime number"
}
Error (no key)
403 Forbidden
{
"error": "please include the api key in your query"
}