4
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.
What degree of precision do we need? Why can't I just hard code the formula if it's always a constant number? Why would I have to calculate any numbers at all? – Morgan Thrapp – 2016-02-08T21:39:19.647
Infinite precision - it's a symbolic expression, not a number. You can hard-code it, though I think you can do better. – anatolyg – 2016-02-08T21:40:28.490
1I think this question has been misunderstood. It's fairly clear to me. It's a Kolmogorov complexity requiring An ASCII Math expression evaluating to
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? – Level River St – 2016-02-09T01:17:55.117Oops: I missed
calculating 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. – Level River St – 2016-02-09T01:25:35.530I removed the confusing part about built-in functions. It's actually interesting to see how one could use dedicated functions to solve this. Wolfram-alpha doesn't try to solve this.
– anatolyg – 2016-02-09T09:41:44.333