All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Palindromic number counting (Posted on 2006-06-22) Difficulty: 3 of 5
Suppose you want to know how many palindromes are in the set of integers from 1 to N. Can you provide a formula for this? Otherwise, can you give an algorithm, as efficient as possible, to find the answer? And, are there special values of N for which there is a simple formula?

No Solution Yet Submitted by Sir Percivale    
Rating: 3.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Zeroes allowed? | Comment 2 of 3 |
If you allow leading zeroes, then if N=2K, you got 10^K-1 possibilities (excluding 000....000); if N=2K-1, the answer is also 10^K-1.

To show why, if N=6, you got 001100, 002200, ..., to 998899, and 999999. For N=5, you got 00100, 00200, ... 99899, and 99999.

  Posted by Old Original Oskar! on 2006-06-22 12:47:15
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (13)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information