wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> medium >> bus passengers
(Message started by: Richthofen on Aug 2nd, 2002, 10:58pm)

Title: bus passengers
Post by Richthofen on Aug 2nd, 2002, 10:58pm
---------------------------------------------------------
The UC Berkeley bus had a minimal number of passengers. When it arrived at Telegraph Avenue, 3/4 of the passengers  got out, and 7 people got on. At the next two stops, Shattuck and Hearst, the same thing happened. How many got off at Hearst?
---------------------------------------------------------
I got 9; 52 passengers were on originally.  Anyone else get that?

Title: Re: bus passengers
Post by william wu on Aug 3rd, 2002, 1:56am
yes, that is the optimal answer. you should explain the reasoning behind your answer though  :)

Title: Re: bus passengers
Post by HammerSandwich on Aug 6th, 2002, 4:04pm
I wasn't expecting 52 from "minimal number of passengers," but...

Let x = original number on the bus.  After the first stop, the bus has x/4 + 7 on board.

Do the same thing again at the second stop, where it leaves with x/16 + 7/4 + 7.

We want to know how many exit (call it y), so multiply that result by 3/4, giving y = (3x + 420) / 64.  Since people come in whole numbers,  (3x + 420) needs to be a multiple of 64.  I may have just missed something, but I didn't see how to build a second equation here, so I just brute-forced it from here out.  I started at y = 7 (since 420/64 = 6.5625) and wound up with y=9.

Did I miss an easy 2nd equation?  Is there an easy way to do that last step?

Title: Re: bus passengers
Post by pythagoras on Aug 12th, 2002, 2:18pm
Yeah, the "easy way" is just number theory. However, with so little brute force necessary for this problem, I wouldn't bother. Number theory would be more useful for solving something like

y = (128397x + 127) / 65024

y = 389, x = 197

This takes quite a bit of work, but if you don't have access to something programmable, brute force would be much worse.

Title: Re: bus passengers
Post by rugga on Sep 1st, 2002, 2:18am

on 08/06/02 at 16:04:29, HammerSandwich wrote:
I wasn't expecting 52 from "minimal number of passengers," but...

Let x = original number on the bus.  After the first stop, the bus has x/4 + 7 on board.

Do the same thing again at the second stop, where it leaves with x/16 + 7/4 + 7.

We want to know how many exit (call it y), so multiply that result by 3/4, giving y = (3x + 420) / 64.  Since people come in whole numbers,  (3x + 420) needs to be a multiple of 64.  I may have just missed something, but I didn't see how to build a second equation here, so I just brute-forced it from here out.  I started at y = 7 (since 420/64 = 6.5625) and wound up with y=9.

Did I miss an easy 2nd equation?  Is there an easy way to do that last step?


One method is to note that after the 2nd bus stop the number
of passengers must be divisible by 4, and that is the only requirement.
Using your formula for the number of passengers after the 2nd stop:

x/16 + 7/4 + 7  = 4k (where k is some integer)
Simplifying:
x/16 + 35/4  = 4k

x + 140 = 64k

x = 64k - 140  =  64k - 3*64 + 52
                    =  64k' + 52   (where k' = k-3)
So in other words, as long as x is 52 more than some multiple of 64,
the number of passengers after the 2nd stop will be divisible by 4.

The smallest such (positive) number is 52 itself.  So x=52.
Then:
 original number:  52
 1st stop: 39 get off, 7 get on,  20 left
 2nd stop: 15 get off, 7 get on, 12 left
 3rd stop:  9 get off

The above equations could also be written with "modulo notation"
but I didn't know how to make that symbol, and the meaning is the
same.
 I don't know if you'll find this "easier" but it works for me.

- rugga


Title: Re: bus passengers
Post by HammerSandwich on Sep 1st, 2002, 10:35am
Hey, Rugga.  Great way to build a 2nd equation!  Thanks.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board