Let G be the graph with 100 vertices numbered 1 to 100. Two vertices i and j…
1997
Let G be the graph with 100 vertices numbered 1 to 100. Two vertices i and j are adjacent if |i−j|=8 or |i−j|=12. The number of connected components in G is
- A.
8
- B.
4
- C.
12
- D.
25
Attempted by 23 students.
Show answer & explanation
Correct answer: B
Whenever a graph on the integers is built by joining vertices that differ by one of a fixed set of step sizes, the vertices reachable from a given vertex by combining those steps (forward or backward, any number of times) are exactly the ones congruent to it modulo the GCD of the step sizes — so the connected components of such a graph are precisely the residue classes modulo that GCD.
Applying this to the given adjacency rule:
The two step sizes are 8 and 12, and gcd(8, 12) = 4.
From any vertex n, going +12 then −8 reaches n + 4 whenever n + 12 ≤ 100, and going −8 then +12 reaches n + 4 whenever n − 8 ≥ 1; for every n from 1 to 96 at least one of these two orders keeps both intermediate vertices inside 1–100 (n ≤ 88 covers the first, n ≥ 9 covers the second, and together they cover every n), so n and n + 4 are always connected by a two-edge path without leaving the graph.
Both 8 and 12 are themselves multiples of 4, so every edge keeps a vertex inside its own residue class modulo 4 — no edge can ever cross between two different residue classes.
So the 100 vertices split into exactly the four residue classes modulo 4:
1, 5, 9, 13, …, 97
2, 6, 10, 14, …, 98
3, 7, 11, 15, …, 99
4, 8, 12, 16, …, 100
each with 100 / 4 = 25 vertices. Within a class, any two members differing by 4 are joined by the boundary-safe path from step 2, so each residue class forms a single connected chain — one component, not several.
Cross-check: 4 components × 25 vertices = 100, matching the vertex count exactly, and since step 3 shows no edge crosses between residue classes, the component count cannot be lower than 4 either. So the number of connected components in G is 4.