Post Go back to editing

KCC's Quizzes: Contaminated Pills

  1. Eight jars with hundreds of identical looking pills, although 7 jars have medicine pills of 1000 mg each, 1 jar has contaminated pills of 999 mg each. The contaminated pills are ever so slightly lighter than the medicine pills. You have a precise electronic scale (precision better than 1mg). With ONE (1) weighing, how can you detect the jar with the medicine pills?
  2. Same question as above but the situation is there could be multiple jars with contaminated pills. With ONE (1) weighing, how can you identify which jars (could be multiple) have contaminated pills?

Many thanks to Ralph Montforts, ADI Director, General Accounting for proposing this quiz!



Edit title
[edited by: emassa at 3:46 PM (GMT -5) on 18 Jan 2023]
Please share your answer to view other submitted answers
Parents
  • Hi,

    1. Number the jars from 1 to 8 and place N pills from the N-th jar on the scale using all jars. W is the measured weight in mg units. The serial number of the jar containing the 999 mg pills is 1000*(1+2+3+4+5+6+7+8)-W.
    2. Number the jars from 0 to 7 and place 2^N pills from the N-th jar on the scale using all jars. W is the measured weight in mg units. If the N-th bit in the binary representation of W-255*999 is 0, then the N-th jar contains 999 mg pills. Note, that other sets of 8 integer numbers can also be used if the sum of any subset is not in the set.

    ADI offers accurate enough ADCs to do the job for both cases using a precision load cell :-).

    Zoltan

Reply
  • Hi,

    1. Number the jars from 1 to 8 and place N pills from the N-th jar on the scale using all jars. W is the measured weight in mg units. The serial number of the jar containing the 999 mg pills is 1000*(1+2+3+4+5+6+7+8)-W.
    2. Number the jars from 0 to 7 and place 2^N pills from the N-th jar on the scale using all jars. W is the measured weight in mg units. If the N-th bit in the binary representation of W-255*999 is 0, then the N-th jar contains 999 mg pills. Note, that other sets of 8 integer numbers can also be used if the sum of any subset is not in the set.

    ADI offers accurate enough ADCs to do the job for both cases using a precision load cell :-).

    Zoltan

Children