Fog Creek Software
Discussion Board




nuggets

The old answer was 43, my answer is 44, here is why:

1)First let's solve this: Find the smallest integer N(N>0), where
N=6X+9Y+20Z
and X, Y ,Z are non-negative integers.
The solution would be X=1, Y=Z=0, and N=6;

2)Next we need to make sure N+1, N+2, N+3, N+4, N+5
can be expressed as 6X+9Y+20Z as well. (another pack of 6 will take care of N+6). Consider the following:

1 = 2*6+9-20
2 = 20-2*9
3 = 9-6
4 = 4*6-20
5 = 20-6-9

In other words, to buy one more nugget, we need to add 2 packs of 6, one pack of 9, and remove 1 pack of 20; To buy 2 more nuggets, we would add 1 pack of 20, and remove 2 packs of 9, and so on.

Thus Y and Z can not be 0, instead, we must have
Y=2 and Z=1 ==>

N=6X+9Y+20Z=6*1+9*2+20*1=44

Pan, Wenyu
Monday, December 16, 2002

actually i believe the answer should be 41, since,
20 + 9 + 6 + 6 = 41,
i'm assuming the question is looking for the smallest number N, equal to or greater than which any number of nuggets can be bought.

since 43 nuggets can be bought (20 + 6*4 + 9) and 42 (6*7), AND 41, that should be the correct answer

ubaid dhiyan
Monday, December 16, 2002

ubaid,

How can you buy 43? 20+6*4+9 = 53

Pan, Wenyu
Monday, December 16, 2002

*  Recent Topics

*  Fog Creek Home