Overview
Introduction
Fibonacci primes sit at the intersection of two of number theory's most-studied topics, the Fibonacci sequence and prime numbers, and they get progressively rarer the further out you look.
This tool searches forward through the Fibonacci sequence, testing each term for primality, and returns the first N that qualify.
What Is Generate Fibonacci Primes?
A generator that filters the Fibonacci sequence down to only the terms that are also prime numbers: 2, 3, 5, 13, 89, 233, 1597, and so on.
It combines Fibonacci term generation with a Miller-Rabin primality test capable of handling the hundreds-of-digits-long numbers that appear deeper in the sequence.
How Generate Fibonacci Primes Works
The tool walks the Fibonacci sequence term by term using BigInt arithmetic, testing each term for primality as it's produced.
Primality testing first rules out small prime factors directly, then applies a Miller-Rabin test with a fixed set of witness bases for larger candidates; qualifying terms are collected until N have been found or the search range is exhausted.
When To Use Generate Fibonacci Primes
Use it whenever you need the specific subsequence of Fibonacci numbers that are prime, for number theory coursework, puzzle-solving, or curiosity about how the two properties overlap.
If you just need plain Fibonacci numbers without the primality filter, use Fibonacci Number Generator instead.
Often used alongside Generate Fibonacci Numbers, Generate Prime Numbers and Generate Lucas Primes.
Features
Advantages
- Handles the large numbers involved correctly, Fibonacci terms in the hundreds of digits are tested exactly as reliably as small ones.
- Saves the work of generating a Fibonacci sequence yourself and manually checking each term for primality.
- Searches automatically as far as needed within its range, you just specify how many results you want.
Limitations
- Capped at 20 results, since known Fibonacci primes become sparse and the search has to stay within a range that resolves in a reasonable time.
- Uses Miller-Rabin, a probabilistic primality test, though the fixed witness set used here is exact for every number size this tool can produce.
Examples
Best Practices & Notes
Best Practices
- Keep expectations realistic about count size, Fibonacci primes thin out quickly, so this isn't a tool for generating hundreds of them.
- If the search reports it couldn't find enough terms, try a smaller count rather than assuming something's broken, it means the next Fibonacci prime lies beyond the tool's search range.
Developer Notes
The Miller-Rabin implementation uses the fixed witness set {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}, which is deterministic for every integer below roughly 3.3 x 10^24 and an extremely reliable probabilistic test well beyond that range; combined with a hard search cap on how many Fibonacci indices are scanned, this keeps worst-case runtime bounded no matter what count is requested.
Generate Fibonacci Primes Use Cases
- Studying which Fibonacci numbers are also prime for number theory coursework
- Generating known Fibonacci-prime reference values for testing a primality-testing implementation
- Exploring the (still unproven) conjecture that infinitely many Fibonacci primes exist
Common Mistakes
- Requesting a count well above 20 expecting it to just take longer, the tool caps the count outright rather than let a search run indefinitely.
- Assuming every Fibonacci number with a prime index is itself prime, that's not guaranteed, it's only true in the reverse direction for the known Fibonacci primes above 3.
Tips
- Compare this list against Lucas Prime Generator to see how the two closely related sequences differ in which terms are prime.
- Cross-check a specific value against Prime Number Sequence Generator's output if you want to confirm a term is prime independent of its Fibonacci origin.