Re: A puzzle
Re: A puzzle
- Subject: Re: A puzzle
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 21 Nov 2008 11:22:55 -0500
On Fri, Nov 21, 2008 at 10:59 AM, Michelle Steiner
<email@hidden> wrote:
> Your car odometer has 6 digits, from 000000 to 999999.
>
> If your car made it to 1,000,000 miles, how many times would the
>
> number 1 have shown up?
I'm assuming that mile "101,101" counts as having 1 show up four
times... in which case the logic is straightforward:
Every ten miles it shows up in the rightmost digit. So that's
1000000/10 = 100,000 times.
Every 100 miles it shows up in the second digit from the right, but it
stays there for ten miles. So that's 10 * 1000000/100 = another
100,000 times.
The pattern continues: every 1000 miles it shows up in the third digit
from the right and stays there for 100 miles. So that's another 100 *
1000000/1000 = 100,000 times.
Basically, each of the six digits contributes 100,000 occurrences of
the digit 1 over the course of a million miles, so the answer is
600,000 - assuming multiple 1's per mile count.
But that's logical deduction, not computation; interms of a
programmable algorithm, other than writing an AI that can make that
same deduction, I'm not sure you can do much better than the brute
force method.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >A puzzle (From: Michelle Steiner <email@hidden>) |