Number of palindromes made of n digits

  • B
  • Thread starter archaic
  • Start date
In summary, the conversation discusses a formula for finding the number of palindromes made of n digits, with different equations for even and odd n values. The formula was discovered by the speaker and may exist elsewhere on the internet. There is a brief discussion about the formula's validity for n=1 and n=2, with a conclusion that it works for n=2 but there is a discrepancy for n=1 due to the inclusion of 0 as a palindrome. The speaker also explains the logic behind the formulas and thanks the other person for their input.
  • #1
archaic
688
214
Hello! A while I tried to find a formula that allows finding the number of palindromes and I actually came up with something :
So let's say P is the number of palindromes made of n digits,
if n is even then [tex]P = 9 * 10^\frac{n-2}{2}[/tex]
else if n is odd and =/= 1 then [tex]P = 9 * 10^\frac{n-1}{2}[/tex]
This probably exists somewhere on the internet, but who knows ..
See ya!
 
Last edited:
Mathematics news on Phys.org
  • #2
does it work for n=1 and n=2?
 
  • #3
phinds said:
does it work for n=1 and n=2?
Thanks for your answer, I didn't consider n = 1 ..
It works for n = 2 though, 9 * 100 = 9 (11,22,33,44,55,66,77,88,99).
 
Last edited:
  • Like
Likes Janosh89
  • #4
Where is the problem with n=1? All 1-digit numbers are trivial palindromes, and the formula gives 9.

There are 9 options for the firs digit (no 0) and 10 options for each following digit up to the center of the number. For even n this means a total of n/2 numbers you are free to choose, for odd n it is (n+1)/2. Taking out the first one, we have (n-2)/2 and (n-1)/2 digits with 10 choices and 1 digit with 9 choices. The rest of the number follows from these choices. And that leads to the formulas in the first post.
Nice observation!
 
  • #5
mfb said:
Where is the problem with n=1? All 1-digit numbers are trivial palindromes, and the formula gives 9.

There are 9 options for the firs digit (no 0) and 10 options for each following digit up to the center of the number. For even n this means a total of n/2 numbers you are free to choose, for odd n it is (n+1)/2. Taking out the first one, we have (n-2)/2 and (n-1)/2 digits with 10 choices and 1 digit with 9 choices. The rest of the number follows from these choices. And that leads to the formulas in the first post.
Nice observation!
Thank you!
I went to check and actually it states here that 0 is considered a palindrome.
 
  • Like
Likes scottdave
  • #6
It is a palindrome, but is it a 1-digit number?
A matter of definition I guess.
 
  • Like
Likes Janosh89 and archaic

1. How do you define a palindrome?

A palindrome is a word, phrase, or sequence of characters that reads the same backward as forward.

2. How many palindromes can be made with n digits?

The number of palindromes that can be made with n digits is dependent on the value of n. For example, if n is 2, then there are 9 possible palindromes (11, 22, 33, etc.). If n is 3, then there are 90 possible palindromes (101, 202, 303, etc.). The formula to calculate the number of palindromes with n digits is 9 * 10^(n-1).

3. Can a palindrome be made with an odd number of digits?

Yes, a palindrome can be made with an odd number of digits. For example, 121 is a palindrome with 3 digits. However, it will always have a middle digit that is the same when read backward and forward.

4. Are there any patterns in the number of palindromes made of n digits?

Yes, there are patterns in the number of palindromes made of n digits. For example, the number of palindromes made of 2 digits is always a single digit (9). The number of palindromes made of 3 digits is always a two-digit number ending in 0 (90). These patterns can be seen by using the formula mentioned in question 2.

5. Can a palindrome be made using only 0's and 1's?

Yes, a palindrome can be made using only 0's and 1's. For example, 101 is a palindrome with 3 digits. In general, any combination of 0's and 1's with an odd number of digits will result in a palindrome.

Similar threads

  • General Math
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
1
Views
811
  • Programming and Computer Science
Replies
1
Views
871
  • General Math
Replies
2
Views
874
Replies
4
Views
206
Replies
4
Views
405
Replies
3
Views
970
  • General Math
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • General Math
Replies
1
Views
1K
Back
Top