A constructible polygon is a regular polygon that can be constructed using only a compass and a straightedge.
Amazingly, Gauss found a way to identify which regular n-gon (abbreviation for a polygon, with n being the number of sides) is constructible, without even attempting to construct the polygon. Gauss's theorem states that an n-gon is contractible if and only if the totient of n is a power of 2. (The Euler Totient Function of a number n is defined as the number of integers from 1 to n that are coprime to n.)
For example, the 3-gon (equilateral triangle) is constructible because the totient of 3 is 2. Similarly, the 5-gon (regular pentagon) is constructible because the totient of 5 is
. While, the 21-gon is non-constructible since the totient of
is
, not a power of 2.
For
to
, the number of sides of the n-gons that are constructible are as follows
and their totients,
, are all powers of 2. The non-constructible n-gons from 3 to
are:
, and their totients are
.
Given the limit of the number of sides m, write a function that will output the sum of the areas of all non-constructible regular n-gons, for
, inscribed in a unit circle (i.e.
).
NOTES:
- Equality in float class is hard to establish. Therefore, for consistency, please round-off each area to 4 decimal places, before taking the total.
- For
, the function should return
, because the sum of areas of regular polygons with sides
=
.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers8
Suggested Problems
-
1718 Solvers
-
Project Euler: Problem 9, Pythagorean numbers
1410 Solvers
-
Find the sum of the elements in the "second" diagonal
1211 Solvers
-
Sums of cubes and squares of sums
386 Solvers
-
Characterize the final state of another digit inventory sequence
19 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!