Cutting a Circular Pizza VerticallyCutting a Circular Pizza Vertically
code-golfmathgeometrytrigonometry
Most people would cut circular pizzas into circular sectors to divide them up evenly, but it's also possible to divide them evenly by cutting them vertically like so, where each piece has the same area (assume the pizza has no crust):
Challenge
Your task is to make a program or function that takes a positive integer \$n\$ where \$2 \le n \le 100\$ that represents how many vertical slices a circular pizza with a radius of \$100\$ will be cut into as input and outputs the horizontal distance from the center of each cut (which will make each slice have the same area) from left to right (or right to left, since the cuts are symmetrical), rounded to the nearest integer.
Note that this will probably require more than just a simple formula.
Rules
- Input and output can be in any convenient format.
- If one of the distances has a fractional part of 0.5 (which I doubt will happen in this scenario), round it up.
- This is code-golf, so the shortest code in bytes in each language wins.
Test cases
Input | Output |
---|---|
2 | [0] |
3 | [26, 26] |
4 | [40, 0, 40] |
5 | [49, 16, 16, 49] |
6 | [55, 26, 0, 26, 55] |
7 | [60, 34, 11, 11, 34, 60] |
8 | [63, 40, 20, 0, 20, 40, 63] |
9 | [66, 45, 26, 9, 9, 26, 45, 66] |
10 | [69, 49, 32, 16, 0, 16, 32, 49, 69] |
50 | [90, 83, 78, 73, 69, 64, 60, 57, 53, 49, 46, 42, 39, 35, 32, 29, 25, 22, 19, 16, 13, 9, 6, 3, 0, 3, 6, 9, 13, 16, 19, 22, 25, 29, 32, 35, 39, 42, 46, 49, 53, 57, 60, 64, 69, 73, 78, 83, 90] |
100 | [93, 90, 86, 83, 81, 78, 76, 73, 71, 69, 67, 64, 62, 60, 59, 57, 55, 53, 51, 49, 47, 46, 44, 42, 40, 39, 37, 35, 34, 32, 30, 29, 27, 25, 24, 22, 21, 19, 17, 16, 14, 13, 11, 9, 8, 6, 5, 3, 2, 0, 2, 3, 5, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 25, 27, 29, 30, 32, 34, 35, 37, 39, 40, 42, 44, 46, 47, 49, 51, 53, 55, 57, 59, 60, 62, 64, 67, 69, 71, 73, 76, 78, 81, 83, 86, 90, 93] |