A friends at an amusement park. They all fancy a ride, which takes exactly B people on at a time, with B < A .
There areIf each of them want to ride it the same (positive) number of times, what is the minimum number of times that each of these people have to ride it?
Assume that no other people are available to ride with them, and that they can ride it as many times as they want.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Can you please solve this for 10 friends and at each time, only 3 people can go?
Define k to be the total number of people that go on the ride (by counting the same person multiple times if necessary). For example: If there are 6 friends, and each person rides 3 times, then k = 6 × 3 = 1 8 . You can also think of k as the number of tickets sold.
k can be counted in two ways.
Since we counted the same item in two different ways, they must be equal. Therefore,
A x = B y
The question is asking the minimum value of x . x will be minimum when y is minimum since x is proportional to y .
x = A B y
Claim: I claim that the minimum value of x is g cd ( A , B ) B
Proof: We can make two cases:
Case 1: g cd ( A , B ) = 1
Since g cd ( A , B ) = 1 , A does not divide B . LHS is an integer, so A must divide y , ie y must be an integral multiple of A . The smallest positive integral multiple of A is A itself. We now prove that y can be attain this value.
We will show systematically that as B increases from 1 to A , in each case it is possible for all friends to ride equal number of times with y = A .
We can visualize a A × A matrix with each row i for ride number and column j for friend number. If element a i j = 1 , then it shows that friend j goes on ride i . If element a i j = 0 , then it shows that friend j does not go on ride i . The order of the matrix is A × A since there are A friends so matrix has A columns and y = A rides, so matrix has A rows.
Although many matrices are possible for each B , finding one matrix for each B should suffice.
When B = 1 , we can have a square diagonal matrix. One person goes on every ride (since there is one 1 in each row) and every person goes exactly once.
⎝ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ 1 0 0 0 0 ⋮ 0 0 1 0 0 0 ⋮ 0 0 0 1 0 0 ⋮ 0 0 0 0 1 0 ⋮ 0 0 0 0 0 1 ⋮ 0 ⋯ ⋯ ⋯ ⋯ ⋯ ⋱ ⋯ 0 0 0 0 0 ⋮ 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎞
In this matrix, there are A − 1 'diagonals' going from left up to right down on both sides of the main diagonal. On each side, there are diagonals of length 1 , 2 , 3 , … , A − 1 .
As we increase B by 1 , we must choose any two diagonals (which are filled with 0 's ) - one each from both sides of the main diagonal such that the sum of their lengths is A - and replace them with 1 's. This way, one 1 is added to each row and column.
I will show it for A = 5 , but it works for any positive A . The changes in each step are highlighted with the red color.
B = 1
⎝ ⎜ ⎜ ⎜ ⎜ ⎛ 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎞
B = 2 There are two friends in each ride, and each friend rides twice.
⎝ ⎜ ⎜ ⎜ ⎜ ⎛ 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎞
B = 3 There are three friends in each ride, and each friend rides thrice.
⎝ ⎜ ⎜ ⎜ ⎜ ⎛ 1 1 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎞
B = 4 There are four friends in each ride, and each friend rides four times.
⎝ ⎜ ⎜ ⎜ ⎜ ⎛ 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎞
There won't be B = 5 in this case since g cd ( 5 , 5 ) = 1 .
There exists a valid configuration for each possible B when y = A . So it is proved that y can attain A and we can substitute y = A in A x = B y . We get the minimum of x is B = 1 B = g cd ( A , B ) B .
Case 2: g cd ( A , B ) = 1
In this case we can simply divide both A and B by their g cd to get a coprime integer pair (say ( P , Q ) ) and continue as in case 1.
We get the minimum of x is Q = g cd ( A , B ) B
Thus, in both cases we get the answer = g cd ( A , B ) B □
Problem Loading...
Note Loading...
Set Loading...
Here's the easy solution.
Suppose that the ride runs b times, and each person rides it for a times. Then, A a = B b .
Let G = g cd ( A , B ) and A = G A ∗ , B = G B ∗ . Then, dividing throughout by G , we obtain A ∗ a = B ∗ b . Now, since g cd ( A ∗ , B ∗ ) = 1 , it follows that B ∗ ∣ a , and hence a ≥ B ∗ = G B . This shows that g cd ( A , B ) B is the minimum possible.
We now need to construct it such that this is possible. To do so, we simply create a b × B block, and then list out all of the friends in order, repeating when we get to the end of the list of friends. Then, from the condition, each person will appear in this list exactly a times. Now, we define each ride, to simply be a row in this block, and we are done. Note: The condition of B < A ensures that everyone will be on a particular ride at most once.
As an explicit construction, say that A = 6 , B = 4 . Let the friends be i , j , k , l , m , n . Then, we have a = 2 , b = 3 . The 3 × 4 block that we are creating is
So, the 3 rides are taken by "i,j,k,l" and by "m,n,i,j" and by "k,l,m,n". Of course, they are many ways to form this construction, and this is just one of them.