Fuelly Forums

Fuelly Forums (https://www.fuelly.com/forums/)
-   General Discussion (Off-Topic) (https://www.fuelly.com/forums/f22/)
-   -   "Car Talk" Puzzler (https://www.fuelly.com/forums/f22/car-talk-puzzler-10322.html)

bobc455 11-02-2008 10:21 AM

"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

theholycow 11-02-2008 11:39 AM

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.

skewbe 11-02-2008 11:51 AM

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.

GasSavers_RoadWarrior 11-02-2008 01:09 PM

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.

theholycow 11-02-2008 01:29 PM

Quote:

Originally Posted by RoadWarrior (Post 123173)
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:
https://www.cs.nott.ac.uk/~ef/Compute...Calculator.jpg

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...

GasSavers_RoadWarrior 11-02-2008 01:39 PM

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?

theholycow 11-02-2008 01:44 PM

It's a Pascal calculator, and definitely mechanical.
https://en.wikipedia.org/wiki/Pascal's_calculator

R.I.D.E. 11-02-2008 01:48 PM

I think I need one of those green BC powders.

regards
gary

bobc455 11-03-2008 09:02 AM

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.


All times are GMT -8. The time now is 06:53 PM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.