Find smallest N for 5-and-21 sums
SchonfeldData Scientist · Online AssessmentLast updated
This question evaluates understanding of integer linear combinations and elementary number theory, framed as a Frobenius coin problem that examines representability using non-negative multiples of 5 and 21.
You are given two positive integers: 5 and 21. We say a positive integer x is representable if it can be written in the form
[ x = 5a + 21b ]
for some non‑negative integers a and b (i.e., using any number of 5s and 21s, order does not matter).
For example, 99 is representable because:
- 99 = 21 + 21 + 21 + 21 + 5 + 5 + 5.
Find the smallest integer N such that every integer greater than or equal to N is representable.
Output this minimal value of N.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.