This Fermat number calculator works out the exact value of F_n, the Fermat number for any index n, using the formula 2 raised to the power of 2 raised to the power of n, plus 1. You enter a single whole number n from 0 to 12 into the index field, and the calculator instantly returns three figures: the full Fermat number itself, grouped with commas for easy reading, the total number of digits it contains, and the intermediate exponent 2^n used to build it. Fermat numbers are notable because the inner exponent doubles at every step, so the values explode in size almost immediately, F_0 is a single-digit number but F_12 already runs to thousands of digits. Pierre de Fermat conjectured that every number in this sequence would be prime, and the first five (3, 5, 17, 257 and 65537) are, but Leonhard Euler later proved the sixth is composite, and no further Fermat prime has ever been confirmed despite extensive searching. These primes matter beyond pure curiosity too, since they determine exactly which regular polygons can be constructed using only a ruler and compass. Use this tool to generate any Fermat number in the supported range instantly, check a homework answer, or explore how quickly the sequence grows, and see the formula, a worked example and the underlying assumptions set out in full below.
The nth Fermat number is F_n = 2^(2^n) + 1. The inner exponent 2^n doubles each time, so F_0 = 3, F_1 = 5, F_2 = 17, F_3 = 257, F_4 = 65537, and they grow rapidly after that.
For n = 4, the inner exponent is 2^4 = 16, so F_4 = 2^16 + 1 = 65536 + 1 = 65537, which is prime. Enter 4 to confirm.
A number of the form 2 to the power 2 to the n, plus 1. The first five are 3, 5, 17, 257 and 65537.
No. Fermat thought so, but Euler found that F_5 is composite. Only the first five are known to be prime.
A regular polygon is constructible with ruler and compass only if its number of sides involves distinct Fermat primes.
This calculator is for students, programmers and anyone exploring number theory.