All Euler problems
Project Euler

Cyclic Polyhedra

A cyclic polyhedron has all vertices on a sphere. This problem studies the enumeration of combinatorially distinct convex polyhedra on n vertices, governed by Euler's polyhedral formula and Steinit...

Source sync Apr 19, 2026
Problem #0880
Level Level 38
Solved By 133
Languages C++, Python
Answer 522095328
Length 572 words
geometrygraphcombinatorics

Problem Statement

This archive keeps the full statement, math, and original media on the page.

\((x, y)\) is called a nested radical pair if \(x\)v and \(y\) are non-zero integers such that \(\frac {x}{y}\) is not a cube of a rational number, and there exist integers \(a\), \(b\), \(c\) such that: \[\sqrt {\sqrt [3]{x} + \sqrt [3]{y}} = \sqrt [3]{a} + \sqrt [3]{b} + \sqrt [3]{c}\] For example, both \((-4, 125)\) and \((5,5324)\) are nested radical pairs: \[\sqrt {\sqrt [3]{-4} + \sqrt [3]{125}} = \sqrt [3]{-1} + \sqrt [3]{2} + \sqrt [3]{4}\] \[\sqrt {\sqrt [3]{5} + \sqrt [3]{5324}} = \sqrt [3]{-2} + \sqrt [3]{20} + \sqrt [3]{25}\] Let \(H(N)\) be the sum of \(|x| + |y|\) for all the nested radical pairs \((x, y)\) where \(|x| < |y| < N\).

For example, \(H(10^3 = 2535)\).

Find \(H(10^{15})\). Give your answer modulo \(1031^2 + 2\).

Problem 880: Cyclic Polyhedra

Mathematical Foundation

Theorem (Euler’s Polyhedral Formula). For any convex polyhedron with VV vertices, EE edges, and FF faces:

VE+F=2.V - E + F = 2.

Proof. The surface of a convex polyhedron is homeomorphic to the 2-sphere S2S^2. Any CW-decomposition of a topological space XX satisfies χ(X)=k=0dimX(1)kck\chi(X) = \sum_{k=0}^{\dim X} (-1)^k c_k, where ckc_k is the number of kk-cells. For S2S^2, χ(S2)=2\chi(S^2) = 2 (computed, e.g., via singular homology: H0(S2)ZH_0(S^2) \cong \mathbb{Z}, H1(S2)=0H_1(S^2) = 0, H2(S2)ZH_2(S^2) \cong \mathbb{Z}, so χ=10+1=2\chi = 1 - 0 + 1 = 2). The vertices, edges, and faces of the polyhedron form a CW-decomposition of S2S^2 with c0=Vc_0 = V, c1=Ec_1 = E, c2=Fc_2 = F. Hence VE+F=2V - E + F = 2. \square

Theorem (Steinitz, 1922). A graph GG is the 1-skeleton of a 3-dimensional convex polytope if and only if GG is 3-connected and planar.

Proof. (\Rightarrow) 3-connectivity: This is Balinski’s theorem (1961). Suppose for contradiction that removing two vertices u,vu, v disconnects the graph. Project the polytope onto a plane perpendicular to the line through u,vu, v. The projection of the remaining vertices is connected (they lie on a convex surface minus two points, which is path-connected), yielding a path in the graph — contradiction.

Planarity: Remove a face ff and project the remaining faces from a point just beyond ff onto the plane of ff. This gives a planar embedding (Schlegel diagram).

(\Leftarrow) By the Koebe—Andreev—Thurston circle packing theorem, every 3-connected planar graph has a circle packing realization on S2S^2: place a circle for each face such that tangent circles correspond to adjacent faces. The contact graph is the dual, and lifting to 3D via the canonical polyhedron construction of Brightwell and Scheinerman gives a convex polytope realization. \square

Theorem (Edge-Face Bounds). For any convex polyhedron:

  1. E3V6E \leq 3V - 6 (equality iff all faces are triangles — simplicial polytope),
  2. E3F6E \leq 3F - 6 (equality iff all vertices have degree 3 — simple polytope),
  3. F2V4F \leq 2V - 4 and V2F4V \leq 2F - 4.

Proof. Each face is a polygon with 3\geq 3 edges, and each edge borders exactly 2 faces, so 2E3F2E \geq 3F. Substituting F=2V+EF = 2 - V + E (Euler): 2E3(2V+E)=63V+3E2E \geq 3(2 - V + E) = 6 - 3V + 3E, giving E3V6E \leq 3V - 6. The bound E3F6E \leq 3F - 6 follows by duality (each vertex has degree 3\geq 3, each edge is incident to 2 vertices: 2E3V2E \geq 3V, substitute V=2F+EV = 2 - F + E). The bounds F2V4F \leq 2V - 4 and V2F4V \leq 2F - 4 follow from combining E3V6E \leq 3V - 6 with 2E3F2E \geq 3F and vice versa. \square

Lemma (Handshaking for Polyhedra). Let fkf_k denote the number of kk-gonal faces and vkv_k the number of vertices of degree kk. Then

k3kfk=2E=k3kvk.\sum_{k \geq 3} k \cdot f_k = 2E = \sum_{k \geq 3} k \cdot v_k.

Proof. Each edge borders exactly 2 faces, so summing face sizes counts each edge twice. Each edge is incident to exactly 2 vertices, so summing vertex degrees counts each edge twice. \square

Lemma (Existence of Low-Degree Elements). Every convex polyhedron has either a face with 5\leq 5 edges or a vertex of degree 5\leq 5. More precisely:

k=35(6k)fk+k=35(6k)vk12.\sum_{k=3}^{5}(6 - k)\,f_k + \sum_{k=3}^{5}(6-k)\,v_k \geq 12.

Proof. From Euler’s formula and double counting: 12=6V6E+6F=6V32E+6F=6V3kkfk+6F=6V+k(6k)fk6F+6F12 = 6V - 6E + 6F = 6V - 3 \cdot 2E + 6F = 6V - 3\sum_k k f_k + 6F = 6V + \sum_k(6 - k) f_k - 6F + 6F. Wait — more carefully: 12=6(VE+F)=(6V23E)+(6F23E)+6E6E12 = 6(V - E + F) = (6V - 2 \cdot 3E) + (6F - 2 \cdot 3E) + 6E - 6E. Use kvk=2E\sum k v_k = 2E and kfk=2E\sum k f_k = 2E: 12=k(6k)vk+k(6k)fk12 = \sum_k (6 - k)v_k + \sum_k(6-k)f_k. Since 6k06 - k \leq 0 for k7k \geq 7 (and =0= 0 for k=6k = 6), the positive contributions come only from k5k \leq 5. \square

Editorial

Euler’s formula V-E+F=2 and enumeration of convex polyhedra via 3-connected planar graph counting (Steinitz’s theorem). We use plantri algorithm (Brinkmann-McKay). We then enumerates 3-connected planar graphs by canonical construction path. Finally, iterate over target vertex count n.

Pseudocode

Use plantri algorithm (Brinkmann-McKay)
Enumerates 3-connected planar graphs by canonical construction path
For target vertex count n

Complexity Analysis

  • Time: The plantri algorithm generates each graph in O(1)O(1) amortized time. Since P(n)cγnn7/2P(n) \sim c \cdot \gamma^n \cdot n^{-7/2} with γ21.32\gamma \approx 21.32 (Tutte’s growth constant for 3-connected planar graphs), the total enumeration time is O(P(n))O(P(n)), which grows exponentially in nn.
  • Space: O(n)O(n) per graph for the adjacency representation; O(P(n))O(P(n)) if all graphs must be stored, or O(n2)O(n^2) if processed one at a time.
nnP(n)P(n)
41
52
67
734
8257
92,606
1032,300

Answer

522095328\boxed{522095328}

Code

Each problem page includes the exact C++ and Python source files from the local archive.

C++ project_euler/problem_880/solution.cpp
/*
 * Problem 880: Cyclic Polyhedra
 * Euler's formula V-E+F=2, Steinitz's theorem, polyhedra enumeration.
 * Verifies bounds and known counts for small vertex numbers.
 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool euler_check(int V, int E, int F) {
    return V - E + F == 2;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // Verify Platonic solids
    cout << "=== Platonic Solids ===" << endl;
    struct Solid { string name; int V, E, F; };
    vector<Solid> solids = {
        {"Tetrahedron", 4, 6, 4},
        {"Cube", 8, 12, 6},
        {"Octahedron", 6, 12, 8},
        {"Dodecahedron", 20, 30, 12},
        {"Icosahedron", 12, 30, 20}
    };
    for (auto& s : solids) {
        bool ok = euler_check(s.V, s.E, s.F);
        cout << s.name << ": V=" << s.V << " E=" << s.E << " F=" << s.F
             << " V-E+F=" << s.V - s.E + s.F
             << (ok ? " OK" : " FAIL") << endl;
        assert(ok);
    }

    // Known counts of convex polyhedra types
    cout << "\n=== Polyhedra Counts ===" << endl;
    map<int, ll> P = {{4,1},{5,2},{6,7},{7,34},{8,257},{9,2606},{10,32300},
                       {11,440564},{12,6384634}};
    for (auto& [n, cnt] : P) {
        cout << "P(" << n << ") = " << cnt << endl;
    }

    // Edge bounds
    cout << "\n=== Edge Bounds ===" << endl;
    for (int V = 4; V <= 12; V++) {
        cout << "V=" << V << ": E_max=" << 3*V-6 << " F_max=" << 2*V-4 << endl;
    }

    cout << "\nAnswer: P(10) = " << P[10] << endl;
    return 0;
}