# How do I determine number of strings of length n are palindromes using decimal digits? [duplicate]

I'm struggling with a few of my homework problems so I thought I might ask for some help on them. Here's the question: I'm assuming it requires $\frac{n}{2}$ to determine a number to factorialize?

I'm stumped with the length n part and not sure what to do. Anything is appreciated. Thanks!

## 2 Answers

Hint: The situation is a bit different for even $n$ than it is for odd $n$. We do two examples, and let you handle the general case.

$n=6$: The first $3$ digits can be selected arbitrarily. Then the rest are determined. So there are $10^3$ palindromes of length $6$.

$n=7$: The first $4$ digits are arbitrary, and then the rest are determined.

if we find first half last half are already determined Two cases 1.n is even First half=n/2 So for each digit you can select from 10 numbers So number of palindromes $= 10 ^ {n/2}$

2.n is odd Here middle digit can take any of ten digits So number of palindromes $= 10 ^ {{(n+1)}/2}$