Skip to main content
deleted 2055 characters in body
Source Link
Yousername
  • 4.1k
  • 4
  • 5

Cutting a Circular Pizza VerticallyCutting a Circular Pizza Vertically

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 , so the shortest code in bytes in each language wins.

Test cases

InputOutput
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]

Cutting a Circular Pizza Vertically

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 , so the shortest code in bytes in each language wins.

Test cases

InputOutput
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]
added 625 characters in body
Source Link
Yousername
  • 4.1k
  • 4
  • 5
Input Output
2 [0]
3 [27[26, 27]26]
4 [42[40, 0, 42]40]
5 [51[49, 16, 16, 51]49]
6 [59[55, 2726, 0, 2726, 59]55]
7 [64[60, 3534, 11, 11, 3534, 64]60]
8 [69[63, 4240, 20, 0, 20, 4240, 69]63]
9 TBD[66, 45, 26, 9, 9, 26, 45, 66]
10 TBD[69, 49, 32, 16, 0, 16, 32, 49, 69]
50 TBD[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 TBD[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]
Input Output
2 [0]
3 [27, 27]
4 [42, 0, 42]
5 [51, 16, 16, 51]
6 [59, 27, 0, 27, 59]
7 [64, 35, 11, 11, 35, 64]
8 [69, 42, 20, 0, 20, 42, 69]
9 TBD
10 TBD
50 TBD
100 TBD
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]
added 159 characters in body
Source Link
Yousername
  • 4.1k
  • 4
  • 5

Cutting a Circular Pizza Vertically

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 , so the shortest code in bytes in each language wins.

Test cases

Input Output
2 [0]
3 [27, 27]
4 [42, 0, 42]
5 [51, 16, 16, 51]
6 [59, 27, 0, 27, 59]
7 [64, 35, 11, 11, 35, 64]
8 [69, 42, 20, 0, 20, 42, 69]
9 TBD
10 TBD
50 TBD
100 TBD

Cutting a Pizza Vertically

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 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 formula.

Rules

  • Input and output can be in any convenient format.
  • This is , so the shortest code in bytes in each language wins.

Test cases

Input Output
2 [0]
3 [27, 27]
4 [42, 0, 42]
5 [51, 16, 16, 51]
6 [59, 27, 0, 27, 59]
7 [64, 35, 11, 11, 35, 64]
8 [69, 42, 20, 0, 20, 42, 69]
9 TBD
10 TBD
50 TBD
100 TBD

Cutting a Circular Pizza Vertically

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 , so the shortest code in bytes in each language wins.

Test cases

Input Output
2 [0]
3 [27, 27]
4 [42, 0, 42]
5 [51, 16, 16, 51]
6 [59, 27, 0, 27, 59]
7 [64, 35, 11, 11, 35, 64]
8 [69, 42, 20, 0, 20, 42, 69]
9 TBD
10 TBD
50 TBD
100 TBD
Source Link
Yousername
  • 4.1k
  • 4
  • 5
Loading