• 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: Luther Fuller <email@hidden>
  • Date: Fri, 21 Nov 2008 15:19:53 -0600

The problem might be clearer if it were restated. Something like this ...

	Given a positive integer, n, and a digit, d > 0, how many times
	is the digit d printed in a print-out of all positive integers < 10^n ?

And the answer is ... n * (10 ^ (n - 1)).

But, what if we let d = 0? If we use the brute force script, we find that if n = 6, then there are 488890 zeros in the print-out. Of course, the answer is different in this case since leading zeros aren't printed.

So, what's the pattern and what is the one line formula that yields the correct instant answer?

_______________________________________________
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: "Mark J. Reed" <email@hidden>
References: 
 >A puzzle (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Can't Remove Photos from iPhoto Slideshow using AppleScript / Scripting Bridge
  • Next by Date: Re: A puzzle
  • Previous by thread: Re: A puzzle
  • Next by thread: Re: A puzzle
  • Index(es):
    • Date
    • Thread