Epic Systems Interview Question
Developer Program EngineersCountry: United States
44
Why?
a. 43 can't be decomposed into sum of 6s, 9s, and 20s.
b. 44 to 49 (6 consecutive numbers) all can be decomposed, thus all numbers equal or larger than 44 also can.
Proof by strong induction:
N=44
Basis:
44=20+6+6+6+6
45=9+9+9+9+9
46=20+20+6
47=20+9+9+9
48=9+9+9+9+6+6
49=20+20+9
Inductive hypothesis:
...actually, formal proofs are one of my weaker areas, so I'll use "plain old English" in place of a formally stated inductive hypothesis, etc.
In essence, once we have 6 consecutive base cases, we are trivially able to construct any larger number by adding some multiple of 6 to one of the base cases.
Note: This problem is commonly presented as making exact postage using only stamps of the specified values, so searching one of those solutions should provide a better explanation.
Yes.
- Anonymous May 10, 201520*2 -6*8+9 = 1
So take N = 20x + 6y + 9z then for any sufficiently large N (such that y> 8)
=> N+ 1 = 20x+6y+9z + 1 and we know 20*2-6*8+9=1
=> N+1 = 20x + 6y + 9z + 20*2-6*8+9
=> N+1 = 20x + 20*2 + 6y - 6*8 + 9z+9
=> N+1 = 20(x+2) + 6 (y-8) + 9(z+1)
We can then find N+2 similarly, N + 3, etc.