|
11-02-2008, 11:21 AM
|
#1
|
Site Team
Join Date: Dec 2006
Posts: 659
Country: United States
|
"Car Talk" Puzzler
I try to listen to Car Talk every week. While listening this week, they gave a puzzler:
NEW PUZZLER: One is the Magic Number
Car odometers go from 0 to 999,999. If a car reached 999,999 miles, how many times would the number "1" appear?
I came up with an answer, which I believe to be the correct answer. However they gave a different answer. What answer would you guys come up with?
-BC
__________________
|
|
|
11-02-2008, 12:39 PM
|
#2
|
Registered Member
Join Date: Apr 2008
Posts: 6,624
Country: United States
|
I assume they're talking about the digit 1. If the question is about the number 1, then the answer is "once".
I wouldn't know a nice formulaic way to figure it out. I could probably figure it out pretty quickly with a pen and paper. However, that's not my way; I'd rather have the computer figure it out for me.
I started by popping a CygWin prompt. You could use any Linux/unix/unix-like system or even a DOS prompt, though it would take a few more keystrokes with a DOS prompt. I used the seq command but to do it in DOS you'd need a For loop.
$ seq 0 999999 > 0-999999.txt
I attached the output, a file with numbers 0 through 999999.
Next, I did this:
$ grep --help | more
Unfortunately, I didn't find what I was looking for. I've never needed it before, and I doubt it's common enough to be in grep. Therefore, I loaded the file into Notepad++.
There, I replaced every '1' with a '1' surrounded by CR/LF. Well, I tried to; it seemed to freeze up, so I ignored it for awhile, and just as I was about to give up and quit this post, it finished.
Now I can feed it back through grep and wc.
$ grep 1 0-999999-1.txt | wc -l
600000
That's my answer.
__________________
__________________
This sig may return, some day.
|
|
|
11-02-2008, 12:51 PM
|
#3
|
Registered Member
Join Date: Jan 2007
Posts: 771
Country: United States
|
111,111 times, if, eg, 100,002 and 100,003 only count once.
The 1 in the 100,000 place will appear once, the one in the 10,000 place will appear 10 times, the one in the 1,000 place will appear 100 times, etc. etc.
|
|
|
11-02-2008, 02:09 PM
|
#4
|
Registered Member
Join Date: Feb 2008
Posts: 1,652
|
Hmmm
If it occurs 10% of the time in each column, that's 10%x6=60%, 600,000 times, which seems too high. With 10 symbols 0 to 9 there are 1,000,000 ways of arranging them, in 6 places, if you count 000,000. With 9 symbols this becomes 9^6 which is 531,441 so there's only that number of possible combinations with a 1 missing, i.e. only 468559 combinations that display one or more ones, BUT I guess we're assuming that 111,111 counts for 6 times, not once.
Then if we're assuming the number of times the 1 is brought into display on each wheel, then we only "use" the left hand reel once, the next 10 times, the next 100 times, the next 1000 times, the next 10,000 times, the next 100,000 times, in which case 111,111 is correct.
__________________
I remember The RoadWarrior..To understand who he was, you have to go back to another time..the world was powered by the black fuel & the desert sprouted great cities..Gone now, swept away..two mighty warrior tribes went to war & touched off a blaze which engulfed them all. Without fuel, they were nothing..thundering machines sputtered & stopped..Only those mobile enough to scavenge, brutal enough to pillage would survive. The gangs took over the highways, ready to wage war for a tank of juice
|
|
|
11-02-2008, 02:29 PM
|
#5
|
Registered Member
Join Date: Apr 2008
Posts: 6,624
Country: United States
|
Quote:
Originally Posted by RoadWarrior
Then if we're assuming the number of times the 1 is brought into display on each wheel
|
You must be talking about one of these:
I had a toy one when I was a kid (obviously, a nerd). It was clear plastic, a lot thinner than that, and operated by a pencil or whatever could be stuck into the little holes of the dials which resembled a miniature telephone dial...
__________________
This sig may return, some day.
|
|
|
11-02-2008, 02:39 PM
|
#6
|
Registered Member
Join Date: Feb 2008
Posts: 1,652
|
Heh, what's that a mechanical calculator?
I was meaning mechanical odometers, the numbers are on a round thing which revolves, so I figure it's a wheel.
The electronic ones, well the LCD or Plasma display is usually driven with a high frequency so it's actually switching on and off many times per second.... figure it out then... but if you say, the number of times a 1 is "refreshed" then are we saying the 100,000s "1" is only refreshed once or 100,000 times?
__________________
I remember The RoadWarrior..To understand who he was, you have to go back to another time..the world was powered by the black fuel & the desert sprouted great cities..Gone now, swept away..two mighty warrior tribes went to war & touched off a blaze which engulfed them all. Without fuel, they were nothing..thundering machines sputtered & stopped..Only those mobile enough to scavenge, brutal enough to pillage would survive. The gangs took over the highways, ready to wage war for a tank of juice
|
|
|
11-02-2008, 02:44 PM
|
#7
|
Registered Member
Join Date: Apr 2008
Posts: 6,624
Country: United States
|
It's a Pascal calculator, and definitely mechanical.
http://en.wikipedia.org/wiki/Pascal's_calculator
__________________
This sig may return, some day.
|
|
|
11-02-2008, 02:48 PM
|
#8
|
Registered Member
Join Date: Apr 2008
Posts: 1,264
Country: United States
Location: up nawth
|
I think I need one of those green BC powders.
regards
gary
__________________
|
|
|
11-03-2008, 10:02 AM
|
#9
|
Site Team
Join Date: Dec 2006
Posts: 659
Country: United States
|
I also figured 111,111. But they gave the answer 600,000.
For example when the odometer changes from 182,556 to 182, 557 the 1 does not "appear", it was already there.
If the question was "how many times does the digit 1 exist in numbers between 1 and 999,999" then I would agree with their answer.
-Bob C.
__________________
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Car Talk & Chit Chat |
|
|
|
|
|
» Fuelly iOS Apps |
|
|
|
» Fuelly Android Apps |
No Threads to Display.
|
|