MathsReadCompetitive mathematics
Algorithmic puzzle · integer answereasy25 min

Divisible dice products

Exact Enumeration

Three distinguishable dice each show an integer from 1 to 12. How many ordered triples (a,b,c) have a+b+c=20 and a*b*c divisible by 5?

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

Determine the third die from the first two using the required sum. Verify that it is within range, then test whether the product contains a factor of 5. The dice are distinguishable.

Worked example with different values

With three dice numbered 1–6, a sum of 7 and product divisible by 5 requires a permutation of (1,1,5), giving three ordered triples.

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 →