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$.
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:
The code has ???? for computing Term4. Replace ???? with A4 + G4 and click Run to have Prolog find the unique sequence!
Prolog outputs:
A = 50 D = -11 G = 7 R = 3 Term4 = 206
This matches option (E) 206 on the 2022 AMC 10A exam.
Share your code
Show a friend, family member, or teacher what you've done!