All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Mileage Muse (Posted on 2013-03-26) Difficulty: 3 of 5
Saul was driving to work one day, when he glanced at his car's dashboard and noticed something interesting about his mileage indicators. His odometer, which shows the miles driven since the car was manufactured, hit 12,345.6 miles, and his trip meter read 123.4 miles. So, the meter matches the first four digits on the odometer.

(i) How far must Saul drive - before this happens again?

(ii) What is the smallest distance that Saul can drive so that the two odometers have all ten digits between them, but share no digits in common?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 5 of 7 |

DEFDBL A-Z
trip = 1234
odo = 123456
travelled = 0
DO
    trip = trip + 1
    IF trip > 9999 THEN trip = trip - 10000
    odo = odo + 1
    IF odo > 999999 THEN odo = odo - 1000000
    travelled = travelled + 1
LOOP UNTIL odo \ 100 = trip
PRINT odo; trip, travelled

trip = 1234
odo = 123456
travelled = 0
DO
    trip = trip + 1
    IF trip > 9999 THEN trip = trip - 10000
    odo = odo + 1
    IF odo > 999999 THEN odo = odo - 1000000
    travelled = travelled + 1
    t$ = RIGHT$("0000" + LTRIM$(STR$(trip)), 4)
    o$ = RIGHT$("000000" + LTRIM$(STR$(odo)), 6)
    tst$ = t$ + o$
    good = 1
    FOR i = 1 TO LEN(tst$) - 1
        IF INSTR(MID$(tst$, i + 1), MID$(tst$, i, 1)) > 0 THEN good = 0: EXIT FOR
    NEXT
LOOP UNTIL good
PRINT odo; trip, travelled

finds

133557  1335                10101
132067  9845                8611

indicating that

For part (i), in 1010.1 more miles, the odometer will read 13355.7 and the trip meter 133.5.

For part (ii), in only 861.1 miles from the original scenario, the odometer will read 13206.7 and the trip meter 984.5.


  Posted by Charlie on 2013-03-26 14:33:03
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information