POLCONST - Constructible Regular Polygons
The investigation of which regular polygons can be constructed only with compass and straight-edge is a classical problem in mathematics. Triangle, square, hexagon can easily be constructed, but, can we construct a regular heptagon? It was the German mathematician Gauss (1777-1855) who first proved that one could construct a 17-sided regular polygon and later, in one the of the most beautiful math works of all time (Disquisitiones Arithmeticae, 1798), he gave sufficient conditions to decide which regular polygons can be constructed.
Input
In the first line, an integer T < 50000 representing the number of test cases; then, T integer numbers representing the number of sides of a non-degenerated regular polygon, up to 1000000 (106).
Output
Print “Yes” if the regular polygon can be constructed with compass and straight-edge or “No” otherwise.
Example
Input: 5 5 6 7 8 9 Output: Yes Yes No Yes No
hide comments
shantanu tripathi:
2015-08-22 21:30:36
done using bs :D |
|
[Mayank Pratap]:
2015-07-29 15:51:19
Revised many things and learnt some new maths ... :) |
|
Mani Soni:
2015-05-30 06:02:32
learned about fermat numbers by this question..Good question |
|
TUSHAR SINGHAL:
2015-03-23 18:47:43
my 50th ac :-)
|
|
praveen123:
2014-01-28 13:45:00
I liked the problem very much.
|
|
Alexandre Henrique Afonso Campos:
2014-01-28 13:45:00
The "non-degenerated" part is just a fancy way to say that all the numbers are bigger than 2 (n>2, because the minimum number of sides for a polygon like this is 3).
|
Added by: | campos20 |
Date: | 2013-12-23 |
Time limit: | 1s-2s |
Source limit: | 1000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Classical math. |