Minkowski Sums
Let S_n be the regular n -gon whose vertices are (cos((2k-1)pi/n),\ sin((2k-1)pi/n)), k=1,...,n. How many sides does the Minkowski sum S_1864+S_1865+...+S_1909 have?
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Let $S_n$ be the regular $n$-sided polygon – or shape – whose vertices $v_k$ ($k = 1, 2, \dots, n$) have coordinates: \begin{align*} x_k &= \cos((2k - 1)/n \times 180^\circ)\\ y_k &= \sin((2k - 1)/n \times 180^\circ) \end{align*} Each $S_n$ is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
The Minkowski sum, $S + T$, of two shapes $S$ and $T$ is the result of adding every point in $S$ to every point in $T$, where point addition is performed coordinate-wise: $(u, v) + (x, y) = (u + x, v + y)$.
For example, the sum of $S_3$ and $S_4$ is the six-sided shape shown in pink below:

How many sides does $S_{1864} + S_{1865} + \cdots + S_{1909}$ have?
Problem 228: Minkowski Sums
Mathematical Development
For a convex polygon, each side corresponds to an outward normal direction. The Minkowski sum adds support functions, so its sides are obtained by taking the union of all outward normal directions that appear in the summands.
With the given orientation, the outward normals of are the directions
Two such directions coincide exactly when the fractions reduce to the same rational number. So a reduced fraction
appears in the union if and only if some polygon in the range has a side normal in that direction, which is equivalent to
for at least one .
Therefore each denominator contributes all reduced numerators modulo , namely directions, provided the interval contains a multiple of . The denominator contributes the single direction .
So the answer is
The divisibility condition is easy to test:
Editorial
This problem looks geometric, but the geometry disappears almost immediately. The Minkowski sum only cares about which edge normals occur, and a regular -gon contributes the equally spaced directions .
So the question becomes arithmetic: how many reduced fractions occur with a denominator that divides at least one integer between and ? Once is fixed, there are exactly such fractions. That reduces the whole problem to a totient sieve followed by a short scan over the possible denominators.
Pseudocode
Compute Euler's totient function phi(q) for every q up to 1909.
Start the answer at 1 for the denominator q = 1.
For q from 2 to 1909:
If the interval [1864, 1909] contains a multiple of q:
add phi(q) to the answer
Print the result.
Complexity Analysis
- Time: for the totient sieve, plus a linear scan.
- Space: .
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <iostream>
#include <vector>
using namespace std;
int main() {
const int first = 1864;
const int last = 1909;
vector<int> phi(last + 1);
for (int i = 0; i <= last; i++) {
phi[i] = i;
}
for (int value = 2; value <= last; value++) {
if (phi[value] == value) {
for (int multiple = value; multiple <= last; multiple += value) {
phi[multiple] = phi[multiple] / value * (value - 1);
}
}
}
long long total = 1;
for (int denominator = 2; denominator <= last; denominator++) {
if (last / denominator > (first - 1) / denominator) {
total += phi[denominator];
}
}
cout << total << '\n';
return 0;
}
"""
Problem 228: Minkowski Sums
The outward normals of S_n are the directions 2*pi*k/n, so the Minkowski sum
has one side for each reduced fraction p/q in [0, 1) whose denominator q
divides at least one n in [1864, 1909].
"""
def solve():
first = 1864
last = 1909
phi = list(range(last + 1))
for value in range(2, last + 1):
if phi[value] == value:
for multiple in range(value, last + 1, value):
phi[multiple] = phi[multiple] // value * (value - 1)
total = 1
for denominator in range(2, last + 1):
if last // denominator > (first - 1) // denominator:
total += phi[denominator]
print(total)
if __name__ == "__main__":
solve()