For the next part do the same thing but with nine coins one
For the next part, do the same thing, but with nine coins, one of which is bad - still use 3 weighings. Finally, do it with 13 coins.
Solution
1)For 8
We can find the Bad one in 3 comparations by following steps
Divide these 8 coins into 4 groups
group[1]=[1,2]
group[2]=[3,4]
group[3]=[5,6]
group[4]=[7,8]
Then
Compare group[1] with group[2]
if group[1] has the same weight with group[2]
//now we know[1,2,3,4] are good
if group[1] with group[3]
if group[1] has the same weight with group[3]
//now we know[1,2,3,4,5,6] are good
Compare 1 with 7
if 1 has same weight with 7,then 8 is bad
else 7 is bad
else
// now we know the bad one is in[5,6] and wether if its heavier or lighter
if group[1] is heavier then group[3]//the bad one is lighter
compare 6 with 7, the lighter one is bad
else //the bad one is heavier
compare 6 with 7, the heavier one is bad
//now we know [5,6,7,8] are good
if group[1] is heavier then group[2]
compare group[1] with group[3]
if group[1] has the same weight with group[3]
//now we know the bad one is in[3,4]and the bad is lighter
compare 3 with 4, the lighter is bad
else//now we know the bad one is in[1,2]and the bad one is heavier
compare 1 with 2, and heavier is bad
compare group[1] with group[3]
if group[1] has the same weight with group[3]
//now we know the bad one is in[3,4] and teh bad one is heavier
compare 3 with 4, the heavier is bad
else//now we know the bad one is in[1,2] and the bad one is lighter
compare 1 with 2, the lighter is bad
2)For 9
we can find the bad one in 3 comparitions
divide these 9 into 4 groups
group[1]=[1,2] group[2]=[3,4] group[3]=[5,6] group[4]=[7,8,9]
Repeat the above steps as usally and replace group[4]=[7,8,] with group[4]=[7,8,9]
3)For 13
same for 13 in 3 comparations
group[1]=[1,2,3]
group[2]=[4,5,6]
group[3]=[7,8,9]
group[4]=[10,11,12,13]
Repeat the above steps as usally and replace groups with above values

