MathsReadCompetitive mathematics
Algorithmic puzzle · integer answereasy25 min

Four draws with parity balance

Exact Enumeration

A 4-tuple (a,b,c,d) is drawn from {1,2,...,20} with replacement and order matters. How many 4-tuples have a+b+c+d divisible by 7 and exactly two even entries?

Solve using mathematics, algorithms, or your own code offline. Submit only the final integer here—no program, expression, graph, or written proof.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

How to approach this problem

Track tuple length, sum modulo 7 and even-entry count. Every value, including repeats, is an eligible next choice. The order is significant.

Worked example with different values

Over {1,2}, the ordered length-2 tuples with exactly one even entry are (1,2) and (2,1); both have sum 3.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Number theory: divisors, gcd and modular arithmetic

Report a question or explanation issue

Back to problems →