The problem of which regular polygons can be constructed by ruler and compass alone goes back to the ancient Greeks. They could certainly construct a regular pentagon, for example. Fast forward a couple of thousand years and the nineteen year-old wunderkind Gauss made the first new progress on the problem when he constructed the regular 17-gon. Gauss discovered necessary and sufficient conditions for constructibility of the regular n-gon and he recorded his result in Section VII of Disquisitiones Arithemeticae published in 1801. To explain Gauss's result we need a definition.

Definition A number of the form 22n+1 with n a nonnegative integer is called a Fermat number.

The first 5 Fermat numbers are: 3, 5, 17, 257, 65537. All of these are prime and Fermat conjectured in 1640 that all the Fermat numbers are prime. Rather surprisingly it wasn't until 1732 that Euler pointed out that the next Fermat number 4294967297 is not prime. It is divisible by 641. In fact the first 5 are the only know prime Fermat numbers and it seems reasonable that there are no others.

Theorem (Gauss) A regular n-gon is constructible by ruler and compass alone if and only if

n = 2kp1...pt
where k and t are nonnegative integers and pi are distinct prime Fermat numbers.