One way to construct a regular heptadecagon starts with drawing a horizontal line of length 1
from the center to a vertex. Then the distance along that line from the center to the second vertex is cos(2π/17)
. All other vertices are easy to get.
The goal of this challenge is to print (or produce in any other conventional way) an ASCII math expression involving the operations +
, -
, *
, /
, sqrt()
and the natural numbers, which gives cos(2π/17)
when evaluated. The power operator is not allowed: e.g. sqrt(17)
cannot be written as 17^(1/2)
.
For example (formula taken from Wikipedia):
1/16*(
-1+
sqrt(17)+
sqrt(34-2*sqrt(17))+
2*sqrt(
17+
3*sqrt(17)-
sqrt(34-2*sqrt(17))-
2*sqrt(34+2*sqrt(17))
)
)
Whitespace doesn't matter. The length and complexity of the expression doesn't matter, as long as it's syntactically correct (as defined above) and numerically equivalent to cos(2π/17)
.
Built-in functions are allowed.
cos(2pi/17)
That is, either a straight text compression of the example expression given, or (as an interesting twist) a significant rearrangement of that expression provided it evaluates to the exact same quantity. Is that correct? Minor nitpick: in addition to natural numbers+
,-
,*
,/
andsqrt()
you have also used individual parentheses in other ways so I assume they are allowed. Question: no power operator? No decimals? \$\endgroup\$ – Level River St Feb 9 '16 at 1:17calculating e.g. cos(π/16) would be OK
... That is unclear. We need to know exactly what operators and functions are allowed and what aren't. This question can't be reopened until it's absolutely clear what operators are allowed. I suggest you delete that bit and stick with the square roots. \$\endgroup\$ – Level River St Feb 9 '16 at 1:25