Results 1 to 34 of 34

Thread: Maths Question

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Could someone help me with this please:
    Two trains, both 200 metres long, travel on parallel tracks through a tunnel. One travels at 100 KM/h, the other at 200 KM/h. The front of the fast train enters the tunnel just as it passes the back of the slow train. The back of the fast train leaves the tunnel just as it passes the front of the slow train. How long is the tunnel?
    Thanks for taking a look!

  2. #2
    Junior Member
    Join Date
    Apr 2000
    Posts
    22
    800m long. The fast train has to travel 400m (200m + 200m) to totally overtake the slow train. The slow train (while the fast train is travelling 400m) goes 200m. So after 400m they are parallel. If the fast train goes another 400m, and the slow train goes 200m, then the fast train is in the correct position (at the end of the tunnel). So 400m + 400m = 800m. The tunnel is 800m long.
    This sentence is a lie.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    (x+200)/200=(x-200)/100
    x=600m
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Eh, Am I wrong? Or who is?

    ___(TrainFast)|(trainslow)_____________Tunnel___________(Trainslow)|(trainfast)_____________________ _

    where the | marks tunnel entrance and exit. Is this so?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Junior Member
    Join Date
    Apr 2000
    Posts
    22
    I would hate to seem aggressive, kedaman, BUT IT'S 800 *~/#ing metres long.



    This sentence is a lie.

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I put tunnel length to x, so fasttrain travels x+200 and slowtrain x-200. then i used the s=vt where t1=t2 wich means that s1/v1 = s2=v2. witch means (x+200)/200=(x-200)/100
    x=600. Have I done something wrong?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Junior Member
    Join Date
    Apr 2000
    Posts
    22
    The thing is, kedaman, that the fast train has to travel 400m (if the slow train were not to be moving) to overtake:

    Key:

    ******************

    _ Railtracks
    >>>>> Fast train
    <<<<< Slow train

    ******************

    After 0m:
    >>>>>_____
    _____<<<<<


    After 200m:
    ______>>>>>
    ______<<<<<


    After 400m:
    ___________>>>>>
    ______<<<<<

    So, if we add to the equation the fact that the slow train is moving, the train has to travel twice as far (because it is only making up half the distance as it is in the illustration). So 400 * 2 = 800m.
    This sentence is a lie.

  8. #8
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330

    I think kedaman is correct.

    Hi.
    1. As the fast train enters the tunnle the front of the slow train is 200 meters into the tunnel. (1 slow train length.)

    2. When the fast train has traveled 400 meters and is even with the slow train, the slow train has traveled 200 meters. The front of the slow train is now 400 meters into the tunnel. (2 slow train lengths.)

    3. When the fast train has traveled another 400 meters the end of the fast train is passing the front of the slow train. The slow train has traveled another 200 meters. The front of the slow train is now at the end of the tunnel. (3 slow train lengths.)

    Al.
    A computer is a tool, not a toy.

  9. #9
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    it's 600

  10. #10
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    600 m

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    OK,
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12
    Junior Member
    Join Date
    Apr 2000
    Posts
    22

    I see where I've gone wrong

    OK. I must say I'm not 100% sure on this, but I'll still give it a go:

    As the fast train enters the tunnel, it is 200m behind the slow train. After the fast train has travelled 200m, the slow train has gone 100m, so the fast train is still 100m behind. After the fast train has gone another 200m, the slow train has also gone 100m, so they are now parallel, agreed?

    Then the fast train goes 200m, but the slow train is still 100m behind. Once the fast train has gone another 200m, the slow train has gone 100m, but it is 200m behind all the same, so this must be where the end of the tunnel is. If we add up all of the 200m we get how far the fast train went (800m) but (and this is where I went embarrassingly wrong and forgot to do), the fast train is 200m farther away than the end of the tunnel so we must take away 200m to leave 600m. I'm sorry about that. Sorry, kedaman.

    But it is nice to have an argument.
    Except I usually lose.
    Pathetic, really...
    This sentence is a lie.

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I guess there was a missunderstanding the text or something, thats all, Philosopher, youre thinking great. Im not sure if that sentence is a lie or not, heh
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  14. #14
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Note Actual velocity does not matter

    600 Meters is correct, but Kederman's equation are technically incorrect due to assuming velocities of 200 & 100 meters per hour, not 200 & 100 Kilometers per hour. His result is correct because it is the relative velocity of the two trains which matters. Nobody seems to have noticed this aspect of the problem. Check examples below.

    At 200 meters per hour, front end of fast train would go 800 meters in four hours (from start of tunnel to 200 meters beyond the end of 600 meter tunnel). In the same four hours (@ 100 meters per hour) front end of slow train goes 400 meters: It starts 200 meters into tunnel and gets to end (400 meters away)in 4 hours.

    If trains went 200 % 100 meters per second (3600 time faster) the following would occur. Front of fast train goes the 800 meters in 4 seconds instead of 4 hours, while front of slow train goes 400 meters in 4 seconds. In actual problem the speeds of 200 & 100 Kolometers per hour are intermediate to the examples just described.

    The dinosaur (me) is old, but not too dumb.

  15. #15

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Another Question

    ok, thanks for that one
    now i have another one, which is due in soon

    The postcode on an envelope is a four-digit number. The sum of the digits is even. The first two digits form a two-digit number divisible by 9. The first and third form the square of a whole number, and the second and fourth form a multiple of 11. What is the postcode?
    So far I have this:

    Let x = the post code
    So x = abcd
    So a+b+c+d / 2 = 0
    And ab / 9 = 0
    Possibilities for ab
    9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99

    And ac could be one of 1(1), 4(2), 9(3), 16(4), 25(5), 36(6), 49(7), 64(8) and 81(9)

    And bd / 11 = 0
    Possibilities for ac
    11, 22, 33, 44, 55, 66, 77, 88, 99

    There must be an even amount of the same type of digits.
    For Example:
    if
    a is odd
    b is even
    c is odd
    then
    d has to be even

    OK?

    Thanks


  16. #16
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84
    The solution should be 6343:

    6 + 3 + 4 + 3 = 16
    63 MOD 9 = 0
    SQR(64)= 8
    33 MOD 11 = 0

    Code:
    Private Sub Form_Load()
    Dim a, b, c, d, n As Integer
    
       For a = 1 To 9
          For b = 0 To 9
             For c = 0 To 9
                For d = 0 To 9
                   For n = 1 To 9
                      If (((a + b + c + d)) Mod 2 = 0) And _
                         ((10 * a + b) Mod 9 = 0) And _
                         ((10 * b + d) Mod 11 = 0) And _
                         ((10 * a + c) = n ^ 2) Then
                         Text1 = Text1 & (a & b & c & d & "; ")
                      End If
                   Next n
                Next d
             Next c
          Next b
       Next a
    
    End Sub
    [Edited by Nina on 04-10-2000 at 05:37 AM]

  17. #17
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    OK, here we go
    Code:
    Private Sub Form_Load()
        For n = 0 To 9999
            a = Int(n / 1000)
            b = Int(n / 100) Mod 10
            c = Int(n / 10) Mod 10
            d = n Mod 10
            If (a + b + c + d) Mod 2 = 0 Then
                If (a * 10 + b) Mod 9 = 0 Then
                    If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
                        If (b * 10 + d) Mod 11 = 0 Then
                            If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
                                Debug.Print Format(n, "0000")
                            End If
                        End If
                    End If
                End If
            End If
        Next n
    End Sub
    '0000
    '0040
    '0909
    '0949
    '6343
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  18. #18
    Junior Member
    Join Date
    Apr 2000
    Posts
    22
    It's 6343. I haven't worked it out; (I'm just copying kedaman's answer), but I'm sure it's right.

    (I'll screw up again if I try to find an answer of my own)




    [Edited by Philosopher on 04-10-2000 at 02:41 AM]
    This sentence is a lie.

  19. #19
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    You're only cheating yourself by getting everyone else to do your homework. Trust me when I say this because when you get into the real world of computer programming you're going to need this kind of problem solving skill to be successful.

  20. #20
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    New Jersey
    Posts
    334

    Unhappy explain...

    Ok,
    Someone explain. Where'd 6346 come from? What unit is that?
    Thanks.

  21. #21
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    There is no unit, it's a pure number.

    If you look at the first page of this thread, you'll see that there was a second question, which required you to find a four digit number which would comply with certain rules. Basically these guys are just using a repetitive process with the computer to find the result, although the idea of the question may well have been to find the answer using algebraic techniques. It's much easier to let the computer do the work though
    Harry.

    "From one thing, know ten thousand things."

  22. #22
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Cool Without using a computer....

    Well I decided to work it out myself, so here's my solution.

    So we know:

    A+B+C+D is evenB&D is a multiple of 11
    A&B is divisible by 9
    A&C is the square of an integer


    So, from thi we can infer:

    A+B+C+D mod 2 = 0
    B=D since any multiple of 11 less than 100 has two digits the same
    A&B mod 9 = 0
    B&D mod 11 = 0
    sqr(A&C) is in the range 4<=A&C<=9 since A&C is a two digit number

    Now, since B=D and A+B+C+D is even

    B+D is even, therefore
    If B is odd, D is odd
    If B is even, D is even

    This implies that:

    A+C is even, therefore
    If A is odd, C is odd
    If A is even, C is even

    since the sum of an odd and an even number will always be odd.
    The sum of A+C and B+D must be even according to the stated conditions
    so

    (A+C) mod 2 = (B+D) mod 2


    Now, since A&C is in the set {16, 25, 36, 49, 64, 81} and we know that A+C is even,
    we can infer that A&C cannot be in the set {25, 36, 49, 81} since for those values of
    A&C, A+C is odd. This contradicts the logic we established just now.

    This means that A&C must be in the set {16, 64}
    So A=1, C=6
    OR
    A=6, C=4

    Now, we know that A&B is a factor of 9.

    Therefore A&B must be in the range
    10<=A&B<=19 if A=1
    OR
    60<=A&B<=69 if A=6

    If A=1 and (A&B mod 9)=0 then
    A&B must be 18

    If A=6 and (A&B mod 9)=0 then
    A&B must be 63

    So we have either:

    (1) A=1, B=8, C=6

    OR

    (2) A=6, B=3, C=4


    Now, we know B=D and (A+B+C+D mod 2)=0 (A+B+C+D is even)

    CASE (1):
    A=1, B=8, C=6, D=8
    A+B+C+D=23 ODD
    So we reject case (1)

    CASE (2):
    A=6, B=3, C=4, D=3
    A+B+C+D=16 EVEN
    So we accept case (2)

    Therefore the only possible 4 digit number to satisfy the stated conditions is:

    6343

    [Edited by HarryW on 04-13-2000 at 08:26 PM]
    Harry.

    "From one thing, know ten thousand things."

  23. #23
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Smile I think we can all see which way is best...

    Although you did do very well, Harry, I think we can all see that using a computer is faster and easier.
    You did it the proper way (which is also more boring )


    Oops, almost forgot: the answer is 6343. Of course, I figured that out in my head, the messages just gave me a small hint as to the method.

    I'm getting carried away now. Carried away by aliens... Oh, my God. What's that? and why are they shoving it up my... Aaaaaarrrrgghhh!!!!!!!!

    [Message ends]

    Unfortunately, I'm still alive.
    Courgettes.

  24. #24
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Cool

    Well yeah, it's faster using the computer, but it's, well.... too easy
    Harry.

    "From one thing, know ten thousand things."

  25. #25
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    well I got 6343 in a matter of seconds just by looking at everyone elses answers.

  26. #26
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Lightbulb Go Sam...

    Now Sam's method is by far the easiest and fastest. Don't we agree, class?

    [Not Edited by V(ery) Basic on 00:00 04/12/00]
    Courgettes.

  27. #27
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Lightbulb


    Could someone help me with this please:
    Two trains, both 200 metres long, travel on parallel tracks through a tunnel. One travels at 100 KM/h, the other at 200 KM/h. The front of the fast train enters the tunnel just as it passes the back of the slow train. The back of the fast train leaves the tunnel just as it passes the front of the slow train. How long is the tunnel?
    Thanks for taking a look!
    This will give you 600.000277767334m in 14.400009999624 seconds

    Code:
    Private Sub Command1_Click()
        Dim train1 As Double ' 100kmph train
        Dim train2 As Double ' 200kmph train
        Dim Timed As Double
        
        Time = 0
        train1 = 0
        train1 = train2 + 200
        
        While train2 < train1 + 200
        
            ' check each 100,000th second
            Timed = Timed + 0.00001
            
            train2 = train2 + 5.555555555555E-04  ' 200kmh as m/100,000th of a sec
            train1 = train1 + 2.777777777778E-04  ' 100kmh as m/100,000th of a sec
        
        Wend
        
        Timed = (Timed * 27.7777777777778) + 200
        Label1.Caption = "Less than or equal to " & Timed
    
    End Sub
    [Edited by Paul282 on 04-14-2000 at 12:30 PM]

  28. #28
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    kedaman's method was more efficient

    On my system

    kedaman = 0.11 sec
    nina = 0.56 sec

    could be a big difference in a larger brute force algorithm...

    Anyone beat that ???????????


  29. #29
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Ok, I'm bored I admit it...
    but check this out, just but declaring the vars as LONGs I get 10x the performance gain (note that the last two are both kadamans algorithm with and without strong type!)

    paste this with a button and a label on a form !!!


    Code:
    Public Tim As Double
    
    Private Sub Command1_Click()
    Tim = Timer
    
    Dim a, b, c, d, n As Integer
    
       For a = 1 To 9
          For b = 0 To 9
             For c = 0 To 9
                For d = 0 To 9
                   For n = 1 To 9
                      If (((a + b + c + d)) Mod 2 = 0) And _
                         ((10 * a + b) Mod 9 = 0) And _
                         ((10 * b + d) Mod 11 = 0) And _
                         ((10 * a + c) = n ^ 2) Then
                         Text1 = Text1 & (a & b & c & d & "; ")
                      End If
                   Next n
                Next d
             Next c
          Next b
       Next a
    
    
    Label1.Caption = Format(Timer - Tim, "0.000000000")
    End Sub
    
    Private Sub Command2_Click()
    Tim = Timer
    
    
        For n = 0 To 9999
            a = Int(n / 1000)
            b = Int(n / 100) Mod 10
            c = Int(n / 10) Mod 10
            d = n Mod 10
            If (a + b + c + d) Mod 2 = 0 Then
                If (a * 10 + b) Mod 9 = 0 Then
                    If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
                        If (b * 10 + d) Mod 11 = 0 Then
                            If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
                                Debug.Print Format(n, "0000")
                            End If
                        End If
                    End If
                End If
            End If
        Next n
    
    Label1.Caption = Format(Timer - Tim, "0.000000000")
    End Sub
    
    Private Sub Command3_Click()
    
    Tim = Timer
    
    Dim n As Long
    Dim a As Long
    Dim b As Long
    Dim c As Long
    Dim d As Long
    
    
        For n = 0 To 9999
            a = CLng(n / 1000)
            b = CLng(n / 100) Mod 10
            c = CLng(n / 10) Mod 10
            d = n Mod 10
            If (a + b + c + d) Mod 2 = 0 Then
                If (a * 10 + b) Mod 9 = 0 Then
                    If Sqr(a * 10 + c) = Int(Sqr(a * 10 + c)) Then
                        If (b * 10 + d) Mod 11 = 0 Then
                            If ((a Mod 2) + (b Mod 2) + (c Mod 2) + (d Mod 2)) Mod 2 = 0 Then
                                Debug.Print Format(n, "0000")
                            End If
                        End If
                    End If
                End If
            End If
        Next n
    
    Label1.Caption = Format(Timer - Tim, "0.000000000")
    
    End Sub
    [Edited by Paul282 on 04-14-2000 at 12:21 PM]

  30. #30
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Exclamation


    This will give you 600.000277767334m in 14.400009999624 seconds
    Using Doubles which are floating points gives you only an approximate value. The correct one is still 600m
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  31. #31
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Talking The mind is more efficient than the machine...

    This time, by using the computer you take longer and
    it is less accurate. (Algebra would give you 600m
    exactly).

    I just thought I'd make that totally useless point.

    I'll go then...

    Bye..

    See ya..

    [Oh just b*gger off you ugly piece of dung beetle excrement]

    OK. OK. I'm going...

    [P*ss the *1$@ off]

    See ya!
    Courgettes.

  32. #32

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Post

    Thank you all very much for your help.
    Source Code for VB projects is nice, but I think my Teacher would prefer Mental Arithmetic...

    I have two more for you and that will be all
    For the first one, I have an answer ok...
    A boy in a class of 9 students tells the teacher that the school bus broke down. A girl in the class says that the boy is lying, then another boy says the girl is telling the truth, another girl says the second boy is lying and so on, each girl saying the previous boy is lying and each boy saying the previous girl is telling the truth. Exactly 4 of the students are lying. Did the school bus break down or not?
    MY SOLUTION

    Let 1b = 1st Boy, 2b = 2nd Boy etc.
    Let 1g = 1st Girl, 2g = 2nd Girl etc.
    Let * mark the people think 1b is lying.

    1b says School Bus broke down
    1g says 1b is lying *
    2b says 1g is telling the truth *
    2g says 2b is lying
    3b says 2g is telling the truth
    3g says 3b is lying *
    4b says 3g is telling the truth *
    4g says 4b is lying
    5b says 4g is telling the truth

    So the 4 * people are lying.
    Therefore the bus did break down.
    What do you guys think??

    2nd Problem
    From the time Amanda gets up until her bus leaves at 8 a.m., she uses one seventh of the time having a shower, then one sixth of the remaining time getting dressed, and then one quarter of the remaining time to have breakfast, which she finishes at exactly 7.15 a.m. At what time does she get up?
    PLEASE HELP...




  33. #33
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Cool Question 2

    Took me a while to get this, but consider the following:

    (1/7)x + (6/7)*(1/6)x + (5/7)*(1/4)x + 45 = x

    where x is the time it took.

    solve it down to

    45 = x - (13/28)x

    then x = 84 minutes.

    thus, she got up at 6:36

    bob

  34. #34
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Hoorah! See V(ery) Basic, I did something useful!
    Harry.

    "From one thing, know ten thousand things."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width