Lesson goal: Contest Sequences: Arithmetic and Geometric (AMC 10A Problem 20)

Previous: Contest Number Theory: GCD and LCM | Home | Next: Contest Counting: Digit String Constraints

In the 2022 AMC 10A competition, Problem #20 combines two fundamental sequences—arithmetic and geometric—into a multi-constraint system:

Contest Problem Statement:
"A four-term sequence is formed by adding each term of a four-term arithmetic sequence of positive integers to the corresponding term of a four-term geometric sequence of positive integers. The first three terms of the resulting four-term sequence are 57, 60, and 91. What is the fourth term of this sequence?"

Setting Up the Equations

Let the terms of the two sequences be:
  • Arithmetic progression (AP): $A_1 = a, \; A_2 = a + d, \; A_3 = a + 2d, \; A_4 = a + 3d$.
  • Geometric progression (GP): $G_1 = g, \; G_2 = gr, \; G_3 = gr^2, \; G_4 = gr^3$.
Every term in both sequences must be a positive integer ($a, a+d, a+2d, a+3d \ge 1$ and $g, gr, gr^2, gr^3 \ge 1$).

The problem gives the first three combined terms:
  1. $A_1 + G_1 = a + g = 57 \implies a = 57 - g$.
  2. $A_2 + G_2 = a + d + gr = 60 \implies d + g(r - 1) = 3$.
  3. $A_3 + G_3 = a + 2d + gr^2 = 91 \implies 2d + g(r^2 - 1) = 34$.

The Algebraic Breakthrough

From equation (2), we have $2d = 6 - 2g(r - 1)$. Substituting this into equation (3):
$$6 - 2g(r - 1) + g(r^2 - 1) = 34$$
$$g(r^2 - 2r + 1) = 28$$
Notice that $r^2 - 2r + 1 = (r - 1)^2$, so:
$$g(r - 1)^2 = 28$$
Since $g$ is an integer and $(r - 1)^2$ must be a perfect square dividing $28 = 4 \times 7$:
  • If $(r - 1)^2 = 1 \implies r = 2, g = 28$: Then $a = 57 - 28 = 29$, and $d = 3 - 28(1) = -25$. The third arithmetic term would be $29 + 2(-25) = -21$, which is negative (violating the positive integer rule)!
  • If $(r - 1)^2 = 4 \implies r - 1 = 2 \implies r = 3, g = 7$: Then $a = 57 - 7 = 50$, and $d = 3 - 7(2) = -11$. The arithmetic terms are $50, 39, 28, 17$ — all positive! The geometric terms are $7, 21, 63, 189$ — all positive!
Summing the fourth terms: $17 + 189 = 206$.

Solving with Prolog

In Prolog, we express the domain boundaries and arithmetic relationships directly. Prolog evaluates the system, filters out invalid negative terms, and outputs the fourth term.
valid_sequence(A, D, G, R, Term4) :- between_num(1, 56, G), A is 57 - G,between_num(1, 10, R), D is 3 - G * (R - 1),A + 3 * D > 0, 91 =:= A + 2 * D + G * R * R,Term4 is (A + 3 * D) + (G * R * R * R).
Move the mouse over a dotted box for more information.

Prolog prunes candidate branches where terms turn negative, cleanly pinpointing the unique valid progression.

Now you try. Replace ???? with A4 + G4 and click Run to see all sequence parameters and Term4 = 206!

Type your code here:


See your results here: