Showing posts with label Adobe Puzzle. Show all posts
Showing posts with label Adobe Puzzle. Show all posts

Sunday, September 30, 2012

How will you represent (3AC)14 in base 7 numeral system.


It can be done using this formula!
If a no X is represented in base 14 as
X = an a(n-1) a(n-2) .... a(0)
then in base 7 we can write it as
X=.....rqp
where
p=(2^0)a(0)%7;
q=((2^1)a(1) + p/7)%7
r=((2^2)a(2) + q/7)%7
..........
nth term=((2^n)a(n) + (n-1)th term/7)%7
(will go further because a no. in base 14 will require more digits in base 7).
The logic is simple, just based on properties of bases, and taking into account the fact that 7 is half of 14. Else it would have been a tedious task.
Eg. here it is given 3AC.
C =12;
so last digit is (2^0 * 12)%7 = 5
A=10
next digit is (2^1 * 10 + 12/7)%7 = (20+1)%7=21%7=0
next is 3;
next digit is (2^2 * 3 + 21/7)%7 = (12+3)%7=15%7=1
next is nothing(0);
next digit is (2^3 * 0 + 15/7)%7 = (0+2)%7=2%7=2
Hence, in base 7 number will be, 2105.

Now try how you can perform any base to any other base conversion ?

Monday, September 24, 2012

You are given two hourglasses. One measures 4 minutes and one measures 7 minutes. How would you measure exactly 9 minutes?


StepTime4 minute timer7 minute timer
10 minStartStart
24 minsFlip3 minutes left
37 mins1 minute leftFlip
48 minsStopFlip (1 minute left)
59 mins
Stop

Wednesday, January 18, 2012

Thursday, January 12, 2012

minimize the time taken by all 4 to cross the bridge.

There is a bridge and to travel on it there should be a torch light available.
Only two persons can cross the bride at a time. There are 4 persons on the other side of the bridge. They require 1,2,5,10 minutes respectively to cross the bridge. How much time should it take for all 4 to go to the other side of the bridge.

Remember there is only one torch light. So if two persons cross the bridge with torch light, one has to come back with torch light for others to use torch light. If person with 1 min and 10 minutes cross the bridge together, they take 10 minutes together to cross the bridge(maximum of the time taken by two people).

Your criteria is to minimize the time taken by all 4 to cross the bridge.


Tuesday, August 9, 2011

What is the probability that you toss next time, heads turns up.

A bag contains 5 coins. Four of them are fair and one has heads on
both sides. You randomly pulled one coin from the bag and tossed it 5
times, heads turned up all five times. What is the probability that
you toss next time, heads turns up. (All this time you don't know you
were tossing a fair coin or not).


The probability of getting n consecutive heads is
P(n heads) = 1/5 * 1 + 4/5 * (1/2)^n,
Thus, the probability of getting a head on the n+1st roll given that
you have gotten heads on all n previous rolls is
P(n+1 heads | n heads) = P(n+1) / P(n)
= ( 1/5 * 1 + 4/5 * (1/2)^(n+1) ) / ( 1/5 * 1 + 4/5 * (1/2)^n ).
Multiplying numerator and denominator by 5* 2^(n-1) and recognizing 4
as 2^2 gives
P(n+1 heads | n heads) = (2^(n-1) + 1) / (2^(n-1) + 2)

put n=5 in above expression probability that you toss next time, heads turns up will be 17/18

Saturday, August 6, 2011

What is the probability that the outside of this cube is completely black?

Twenty seven identical white cubes are assembled into a single cube,
the outside of which is painted black. The cube is then disassembled
and the smaller cubes are thoroughly shuffled in a bag.

A blindfolded man (who cannot feel the paint) reassembles the pieces
into a cube. What is the probability that the outside of this cube is
completely black?

Monday, July 25, 2011

There are four dogs each at the corner of a unit square. Each of the dogs starts chasing the dog in the clockwise direction. They all run at the same speed and continuously change their direction accordingly so that they are always heading straight towards the other dog. How long does it take for the dogs to catch each other and where?

Since the dogs are moving symmetrically, the distance saperating them will decrease evenly as they case each other, so the dogs should catch each other in the center of the room. Their path will be curved, but for sake of approximation, lets se it’s a straigt line to the center.

Assuming that the dogs run at 1m/sec, and room is y x y in diamater.

h^2 = (y/2)^2 + (y/2)^2
h^2 = 2(y/2)^2
h = sqrt(2) * y/2
h = y/sqrt(2) meters

thus it would take the dogs approximtly y/sqrt(2) seconds to catch each other. This is a lower bounds, as the dog will not be traveling in a straight line, but along a curve.

Some Other & Good Aproaches are

Each dog starts at the corner and moving symmetrically. So each dogs start moving perpendicular to the adjacent dogs. Lets assume v.

So each one start moving with v towards the next dog.

If we see realtive speed of the dog1 (v1), w.r.t dog 2, it changes perpendicularly. So it’ll not affect the time taken along the direction of the dog1 to dog2 and the speed will be v only always.

So it they have started at corners with the distance of the length of the square(s).

Time = s/v. They’ll meet at the center.

Another Similar Approach is

Let’s the dogs be A, B, C and D where A is chasing B, B is chasing C, C is chasing D and D is chasing A.
All the dogs will eventually meet in the center of the square. Since all the dogs move in symmetry, the only logical answer to the location of their meeting is the center of the square.
At any point in time, dog A is perpendicular to dog B and B perpendicular to C and so on. Dog A moves towards dog B but dog B does not move towards or away from dog A since it is moving perpendicular to dog A. Therefore, the distance that dog A needs to cover to reach dog B is the same as the original distance between them, one unit.

The speed of each of the dog towards the dog it is chasing is given by (1 + cos(t)) where t is the angle on each corner of the square.

Speed of dog = 1 + cos(90) = 1 + 0 = 1
Time needed = Distance/Speed = 1 / 1 = 1 unit.

A Heavan Puzzle

Saturday, May 14, 2011

Which Box Has Defective Balls

You have 10 boxes of balls (each ball weighing exactly10 gm) with one box with defective balls (each one of the defective balls weigh 9 gm). You are given an electronic weighing machine and only one chance at it. How will find out which box has the defective balls?



Firstly 10 boxes of ball kept in a queue and mark it as box1,box2,box3.........box10
then from 1st box we have to take 1 ball,from 2nd box 2 ball..........from 10th box we kept 10 balls. and weight the total ball....

so if total nos ball is :n(n+1)/2 (n= total nos of box that is 10)=55
if all the ball is 10 gm.then total weight will be=550gm.
suppose total weight is 546gm.
so the difference is(550-546=4gm).
then the d defective ball is in box no:4.
similarly we can try for all possible box difference gives us the box number which contains the defective balls

Chess Queen Puzzle

Imagine there are infinite number of Queens (Chess Game Piece) with u. Find the minimum number of queens required so that every square grid on the chess board is under the attack of a queen. Arrange this minimum no. of Queens on a chess board.



to solve it we have to think all possible combination. because we have to find out the one can easily solve it if he has strong foundation of backtracking algorithm its the geeks way to solve . although it can also be solve by trying all possible combinatios thats the normal way

start by putting queen at all position where i=j e.g. 1,1, 2,2 3,3, & so on
so then we have 8 queens like It can also be keeping one at diagonal (0,0) (1,1) (2,2) (3,3) (4,4) (5,5) (6,6) (7,7)

can we do better ..??

as we know This problem has more than one solutions. I found one with 6 queens placed at (0,0), (1,7), (2,1), (3,4), (4,2), (6, 3) now if we rotate the chess board then we can get other solution so in this case we need 6 queen can we do still do better..?? think again



it requires much deep thinking then i was able to come up with two more solution that requires 5 queens & i think that are minimum number of queens we are looking for ...

1st (1,1) (3,4) (3,6) (4,2) (5,5)
2nd (0,0) (1,7) (2,4) (4,0), (7,6)

Queen Needed 5

Feel Free to Update & Optimize Th Solution

Thursday, April 28, 2011

Weighting Puzzles One Side Weighing & two side Weighing



Puzzle 1:

The puzzle is if the shopkeeper can only place the weights in one side of the common balance. For example if shopkeeper has weights 1 and 3 then he can measure 1, 3 and 4 only. Now the question is how many minimum weights and names the weights you will need to measure all weights from 1 to 1000. This is a fairly simple problem and very easy to prove also. Answer for this puzzle is given below.

Solution :


This is simply the numbers 2^0,2^1,2^2 ... that is 1,2,4,8,16... So for making 1000 kg we need up to 1, 2, 4, 8, 16, 32, 64, 128, and 512. Comments your suggestions or other answers.

Puzzle 2:


This is same as the above puzzle with the condition of placing weights on only side of the common balance being removed. You can place weights on both side and you need to measure all weights between 1 and 1000. For example if you have weights 1 and 3,now you can measure 1,3 and 4 like earlier case, and also you can measure 2,by placing 3 on one side and 1 on the side which contain the substance to be weighed. So question again is how many minimum weights and of what denominations you need to measure all weights from 1kg to 1000kg. Answer for this puzzle is given below.

Solution:


For this answer is 3^0, 3^1, 3^2... That is 1,3,9,27,81,243 and 729.

Monday, April 11, 2011

9 Digit Number Problem Every nth number formed by n digit is Divided By Every nth digit

Arrange the digits 0 to 9 such, that the number formed by the
first digit is divisible by 1, the number formed by the first two
digits is divisible by 2, that formed by the first three digits
divisible by 3, and so forth, thus the number formed by the first
9 digits will be divisible by 9 and that formed by all 10 digits
divisible by 10.

Here is what we would do.

_ _ _ _ _ _ _ _ _ _

those are my ten blanks.

Now let's start asking questions.

Since the whole thing has to be divisible by 10, the last number
must be a zero.

And since the first five digits must be divisible by 5, the fifth
digit must be a 5 or 0, but we have already used 0 so it must be a
five.

One last quickie is that the 2nd, 4th, 6th, and 8th and last
digits must be even, so all the rest are odd

So let's look at we have. I'll write the digits that could go in a
certain place under where they could go:


_ _ _ _ 5 _ _ _ _ 0
1 2 1 2 2 1 2 1
3 4 3 4 4 3 4 3
7 6 7 6 6 7 6 7
9 8 9 8 8 9 8 9

Now things get trickier.

Let's start with the 4th spot.

Any number is divisible by 4 if the last two digits are divisible
by 4

So what are the two-digit numbers divisible by 4 that begin with
an odd number that is not 5?

12 16 32 36 72 76 92 96

Hey, so the 4th digit is either a 2 or a 6.

Now, let's look at the 8th digit. If the first 8 digits are
divisible by 8, then they are divisible by 4 also. So if we apply
the same logic as above, we find that the 8th digit is either a 2 or
a 6.

So spaces 2 and 6 must be 4 or 8.

That narrows it down. So we have this:

_ _ _ _ 5 _ _ _ _ 0
1 4 1 2 4 1 2 1
3 8 3 6 8 3 6 3
7 7 7 7
9 9 9 9



Now for my next trick let's recall that every third space must be
divisible by 3. So every three numbers must sum to be divisible
by 3.

In particular spaces 4, 5, and 6 must sum to 3, and we already
have a five. So either we have

2 5 8 or 6 5 4

in positions 4, 5, and 6.

That is good stuff. That means we have either this:

_ 4 _ 2 5 8 _ 6 _ 0
1 1 1 1
3 3 3 3
7 7 7 7
9 9 9 9

or this:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 1 1
3 3 3 3
7 7 7 7
9 9 9 9

Let's check each of the four digits we could put in the 8th place.
Since a number is divisible by 8 if its last 3 digits are, we need
number in the 6th, 7th, and 8th places to be divisible by 8. We see
that 816 and 896 work in the first case, and 432 and 472 work in the
second case. So we have:

_ 4 _ 2 5 8 _ 6 _ 0
1 1 1 1
3 3 9 3
7 7 7
9 9 9

or this:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 3 1
3 3 7 3
7 7 7
9 9 9


Let's look at the 9th place now. Recall that 1+2+3+4+5+6+7+8+9 = 45,
so we don't need to worry about the 9th place - it will always work
out.

Let's look at the 1st and 3rd places. In case 1, only 147 and 741 are
options. In case 2, we could have 183, 189, 381, 387, 783, 789, 981, or
987. Note that 387 and 783 don't work, because then we don't have any
digits left for the 7th digit.

So our first case becomes:

_ 4 _ 2 5 8 9 6 3 0
1 1
7 7

We can just check the two numbers this can give rise to, namely 1472589630
and 7412589630. Since neither of them are divisible by 7, case one must be
a dead end. So we have to work with case two if we want a solution:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 3 1
3 3 7 3
7 7 7
9 9 9

(and the first 3 digits are 183, 189, 381, 789, 981, or 987)

If we look at the 7th, 8th, and 9th digits to see if we can get them to sum
to three, we see that only 321, 327, 723, and 729 are options.

So which of our options for digits 1,2,3 and 7,8,9 can we use together? In
order to not repeat digits, we could use these:

183 and 729
189 and 327
189 and 723
381 and 729
789 and 321
981 and 327
981 and 723
987 and 321

This means that the only possible solutions to the puzzle are these:

1836547290
1896543270
1896547230
3816547290
7896543210
9816543270
9816547230
9876543210

This is now a small enough number of cases that we can check them by hand.
The first thing we should do is check the first 7 digits for divisibility by
seven. Here are the results:

1836547/7 = 262363.857142857...
1896543/7 = 270934.714285714...
1896547/7 = 270935.285714286...
3816547/7 = 545221
7896543/7 = 1128077.57142857...
9816543/7 = 1402363.28571429...
9816547/7 = 1402363.85714286...
9876543/7 = 1410934.71428571...

Sunday, April 10, 2011

There are n buses in a city. Each of them carries at most m passengers. Find the probability that at least two of them carry the same number of passen

There are n buses in a city. Each of them carries at most m passengers. Find the probability that at least two of them carry the same number of passengers.



This is equal to 1-(probability that they all carry different number of passengers). That probability in paranthesis is equal to (m+1)!/((m+1-n)! * (m+1)^n). This is given that (m+1) >= n. If (m+1) < n, then the probability is 1.

- m+1 because maximum m passengers mean m+1 different possiblities (a bus could carry 0 passengers).
- The first bus has (m+1) possibilities in terms of number of passengers. The second has m+1, the third has m+1 and so on. Total number of orderings possible is (m+1) ^ n.
- For the number of passengers to be different in each bus, first bus has m+1 possibilities, second has m, third has m-1 nd so on. For n buses, this is equal to (m+1)!/(m+1-n)!. Dividing this by (m+1)/n gives the possibility. Subtract this number from one to find at least two buses with the same amount of passengers.


Solved by James

Saturday, April 2, 2011

6 Riddles

QUESTIONS:

1) The Elder Twin
One day Kerry celebrated her birthday. Two days later her older twin brother, Terry, celebrated his birthday.
How could this happen?

2) Manhole Covers
Why is it better to have round manhole covers than square ones?

This is logical rather than lateral, but it is a good puzzle which can be solved by lateral thinking techniques. It is supposedly used by a very well-known software company as an interview question for prospective employees.

3) The Deadly Party
A man went to a party and drank some of the punch. He then left early. Everyone else at the party who drank the punch subsequently died of poisoning.
Why wasn't the first guy poisoned?

4) Heaven
A man died and went to Heaven. There were thousands of other people there. They were all naked and all looked as they died at the age of 21. He looked around to see if there was anyone he recognized. He saw a couple and he knew immediately that they were Adam and Eve.
How did he know?

5) Trouble with Sons
A woman had two sons who were born on the same hour of the same day of the same year. But they were not twins.
How could this be so?

6) The Man in the Bar
A man walks into a bar and asks the barman for a glass of water. The barman pulls out a gun and points it at the man. The man says `Thank you' and walks out.
Why?

This puzzle has claims to be the best of the genre. It is simple in its statement, absolutely baffling and yet with a completely satisfying solution. Most people struggle very hard to solve this one yet they like the answer when they hear it or have the satisfaction of figuring it out.





ANSWERS:

1) At the time she went into labor, the mother of the twins was traveling by boat. The older twin, Terry, was born first early on March 1st. The boat then crossed the International Date line (or anytime zone line) and Kerry, the younger twin, was born on February the 28th. In a leap year the younger twin celebrates her birthday two days before her older brother.

2) A square manhole cover can be turned and dropped down the diagonal of the manhole. A round manhole cannot be dropped down the manhole. So for safety and practicality, all manhole covers should be round.

3) The poison in the punch came from the ice cubes. When the man drank the punch the ice was fully frozen. Gradually it melted, poisoning the punch.

4) He recognized Adam and Eve as the only people without navels. Because they were not born of women, they had never had umbilical cords and therefore they never had navels.

This one seems perfectly logical but it can sometimes spark fierce theological arguments!

5) They were two of a set of triplets (or quadruplets etc.)

This simple little puzzle stumps many people. They try outlandish solutions involving test-tube babies or surrogate mothers. Why does the brain search for complex solutions when there is a much simpler one available?

6) The man had hiccups. The barman recognized this from his speech and drew the gun in order to give him a shock. It worked and cured the hiccups - so the man no longer needed the water.

The is a but a difficult one to solve. It is a perfect example of a seemingly irrational and incongruous situation having a simple and complete explanation. Amazingly this classic puzzle seems to work in different cultures and languages.

Friday, April 1, 2011

Another Hat Color Problem

The Island - One puzzle a day - Puzzle Buddies
100 men were captured and prisoned in an island.the island is guarded by a genie.
Everyday genie takes prisoners out.genie places them in a circle so that everyone can see each other,then all the prisoners are blindfolded. Genie then places hats on prisoners head,some of them are white and some of them are red.their folds will be opened after the genie places hats.

On genie's command the prisoners with white hat should step forward.They will be set free if only the men with white hat steps forward.
If any one without white hat steps forward,genie executes all of them
If no one steps forward,the same game will be repeated the next day,if the game is repeated,each prisoner will get the same hat that they got on the first day

Prisoners are not allowed to communicate with each prisoner.if communicated all of them will be executed.prisoners are not allowed to see the hat that they are wearing
At least one white hat is given, and all prisoners are aware of this.

how many days did it take for the prisoners to get out if genie gave "n" white hats where 1<=n<=100, and how did they do it?



Solution:
Let us say there is one white hat,the answer is simple.the prisoner wearing white hat sees no other white hat and he steps forward.
Now let us take two white hats.No body comes forward on the first day,because the prisoners wearing white hat sees one white hat.On the second day since no body has come forward they both know there must be two white hats and one he can see and other must be his own.so they come forward on second day.
Similarly if there are three white hats they will not come out on second day.it will take three days.
and so on..for "n" it will take n days

How can you get a fair coin toss

Interview question: How can you get a fair coin toss if someone hands you a coin that is weighted to come up heads more often than tails?

The story of these types of questions starts at the software giant Microsoft who pioneered the use of puzzle type question, where the aim is to test the interviewers problem solving skills and creativity. It's ironic that these type of questions are no longer asked in Microsoft job interviews, but the rest of the software industry hasn't caught on.



The solution is to toss the coin twice, which gives four possible outcomes:
H (heads) followed by H, probability of this is pH * pH
H followed by T (tails), probability of this is pH * pT
T followed by H, probability of this is pT * pH
T followed by H, probability of this is pT * pT
Looking at the above outcomes we can see that HT (H followed by T) is just as likely as TH,
So to get a fain coin toss, toss the coins and use HT or TH as fair outcomes of the toss, and discard the results of TT and HH.

Another Hat Puzzle

I buried four fishermen up to their necks in the sand on the beach at low tide for keeping their fishing spot a secret from me. I put a hat on each of their heads and told them that one of them must shout out the correct color of their own hat or they will all be drowned by the incoming tide. I give them 10 minutes to do this. Fisherman A and B can only see the sand dune I erected. Fisherman C can see that fisherman B has a white hat on. Fisherman D can see that C has a black hat, and B has a white hat. The fisherman have been told that there are four hats, two white and two black, so they know that they must have either a white or a black hat on. who shouts out the color of their hat and how do they know?

Fisherman C shouts out.

Fishermen A and B are in the same situation - they have no information to help them determine their hat colour so they can’t answer. C and D realise this.

Fisherman D can see both B and C’s hats. If B and C had the same colour hat then this would let D know that he must have the other colour.

When the time is nearly up, or maybe before, C realises that D isn’t going to answer because he can’t. C realises that his hat must be different to B’s otherwise D would have answered. C therefore concludes that he has a black hat because he can see B’s white on

Who Will Tell The Color of His Hat/halos.. First

Four angels sat on the Christmas tree amidst other ornaments. Two had blue halos and two – yellow. However, none of them could see above his head. Angel A sat on the top branch and could see the angels B and C, who sat below him. Angel B, could see angel C who sat on the lower branch. And angel D stood at the base of the tree obscured from view by a thicket of branches, so no one could see him and he could not see anyone either.
Which one of them could be the first to guess the color of his halo and speak it out loud for all other angels to hear?


Case 1: Angels B and C have same color(either both blue or yellow) Then A can be sure of his color.

Case 2: Angles B and C have different colors.
B after waiting for some time will realise that A has not spoken out the color yet ,hence B and C must have different colors. B will look at C's color and announce his color opposite to C's color.

Wednesday, March 30, 2011

Weigh System With More Explaination..How Many Weight We Needs..???

Puzzle: You have a common balance with two sides. You can only keep weighs on one side. You have to weigh items from 1 to 1000 weight units with integral weights only.
What is the minimum number of weights required and what will be their weights?
Eg. With 2 weights one of 1 weight unit and other of 3 weight unit you can measure 1, 3 and 4 only.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow. You can provide your answer in comments.

Solution: This puzzle is an easy puzzle as to make any odd number you need all other even numbers and one 1.
So only one odd number is needed to make all odd numbers. Now you are left with all even numbers. All even numbers are base 2 and thus can be though of as binary representation. To make 1000 you need at most 10 bits(1111101000). You can make any number below 1000 from these bits.
So the answer is 10 weights required. 1, 2, 4, 8,16, 32, 64, 128, 256, 512.

Puzzle: This is part 2 of puzzle posted Above. The puzzle is that you have to weigh 1 to 1000 using a common balance scale with minimum number of weighs. This time you can put wights on both sides.
You can check Part 1 of this puzzle How many weights? Puzzle Part 1.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow with winner's name. You can provide your answer in comments.

Solution: The answer is series of base 3 i.e. 1, 3, 9, 27, 81, 243 and 729.
We can start from smallest number 1. To measure 1 we definitely need 1.
To measure 2 we need to look for highest number possible. We can measure 2 by using 3(3-1 = 2). So we need 1 and 3.
Now to measure 4 we can use 1 and 3 both (1+ 3). To measure 5 again we will look for highest possible number. 9 is highest possible number (9-4 = 5). We can measure up to 13 using these weights.

Continuing the same way we can deduce that a series of base 3 is required, thus 1, 3, 9, 27, 81, 243, 729.


Puzzle: This is the 3rd part of weighing puzzles. You can check Part 2 and Part 1.
You have to weigh 125 packets of sugar with first one weighing 1 lb, second 2 lb, third 3 lb and so on.You can only use one pan of the common balance for measurement for weighing sugar, the other pan has to be used for weights.
The weights have to put on to the balance and it takes time. Time taken to move weights is equal to the number of weights moved.
Eg. So if you are weighing 5 lb using 3lb and 2 lb weight then you have to lift both these weights one by one and thus it will take 2 unit time. If you have to measure only 3lbs it will take only 1 unit time. Now if we have to measure sugar packets of weights 1,3,4 using weights 1 and 3 only. For this first we measure 1 lb, with 1 unit of time, we place 3 lb along with 1 lb and measure 4kg with again 1 unit of time, and finally we move 1kg out of pan to measure 3kg in 1 unit of time. So in 3 units of time we could measure 1,3 and 4lb using weights 1 and 3 only.

Now you have to make sugar packets of all weights from 1 to 125 in minimum time, in other words in minimum movement of weights. The question here is to find out the minimum number of weighs needed and the weight of each the weights used and the strategy to be followed for the creation of 125 packets of sugar.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow with winner's name. You can provide your answer in comments.
Source: Classic Puzzles
Solution: Amazing explanation provided by Kasturi.
You will need the weights 1, 2, 4, 8, 16, 32 and 64 i.e. 7 weights. You can measure 125 packets in 125 movements. The strategy to be followed is this:
Put 1: measure 1, weights in pan 1

To measure further you need to use a new weight.
Put 2: measure 3, weights in pan 1,2
Remove 1: measure 2, weights in pan 2

Thus, by adding the next smallest weight to the pan i.e. 2, we can measure all weights below 4 in total 3 movements.

To measure further you need to use a new weight.
Put 4: measure 6, weights in pan 2,4
Remove 2: measure 4, weights in pan 4
Put 1: measure 5, weights in pan 1,4
Put 2: measure 7, weights in pan 1,2,4

Thus, by adding the next smallest weight to the pan i.e. 4, we can measure all weights below 8 in total 7 movements.

Following the same strategy, whenever we have measured all weights below n, add n and we can measure measure all the weights below 2n in 2n-1 movements.
Eventually, we can measure 125 packets in 125 movements.