• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: A puzzle
      • From: Michelle Steiner <email@hidden>
References: 
 >A puzzle (From: Michelle Steiner <email@hidden>)

  • Prev by Date: A puzzle
  • Next by Date: Re: A puzzle
  • Previous by thread: A puzzle
  • Next by thread: Re: A puzzle
  • Index(es):
    • Date
    • Thread