Thursday, December 17, 2009

How many palindromes are there among the first 1 million whole numbers?

A palindrome is a word, line, number, or sentence that reads the same backward as forward. The first ten digits- 0, 1, 2..,9- are palindromes, but 10 is not. How many palindromes are there among the first 1 million whole numbers?How many palindromes are there among the first 1 million whole numbers?
The answer is 1999, I've created a JAVA program in order to figure it out. Here are the results:


http://www.geocities.com/natengall/mhmm.鈥?/a>How many palindromes are there among the first 1 million whole numbers?
That's a cool question. Let's add em up.





All one digit numbers are palindromes so 9





Only doubles are palindromes for 2 digit numbers so 9





WIth three digit numbers there are 9 choices for the first and last digits which go with 10 possible numbers for the middle one so 90





Four digit numbers work the same as 3 digit numbers so another 90





Five digit numbers there are 9 possible outside numbers combined with 10 possible inside numbers and 10 possible middle numbers so another 900





Six digits works the same as five so another 900





And 1,000,000 is not a palindrome so that's where we stop. My answer then is 1998 (provided I've added that up correctly.
I believe you'll find 1999 palindromic whole numbers under 1m.
  • soccer
  • No comments:

    Post a Comment