Palindrome vs Level of Palindrome

135 Views Asked by At

The palindrome, example: $131$, $82728$, $55655$.

But from the palindrome maker algorithm say:

If $17$ isn't palindrome you must additive by reverse of them

$33$ is say $P(1)$ palindrome

$38$ is say $P(2)$ semipalindrome of level $1$

Because:

$38+83=121$

$182$ is say $P(5)$ semipalindrome of level $4$

Because:

$182+281=463$

$463+364=827$

$827+728=1555$

$1555+5551=6666$

So the question is:

How many semipalindrome of level $1$ between $1-1000$ are?

1

There are 1 best solutions below

0
On BEST ANSWER

If you start with a two digit number $ab$ you get a palindrome in two cases:

  • if $a+b \lt 10$ there will be no carry so you get $11(a+b)$

  • if you carry $1$ and the ones digit is $1$, so when $a+b=11$

If you start with a three digit number $abc$ you get a palindrome:

  • if there are no carries at all
  • if $a+c =11$ so the ones digit of the sum is $1$ and there is a carry, then $2b+1$ does not carry and matches the $1$ that $a+c$ gives in the hundreds, so $b=0$
  • if $a+c=11$ and $2b+1$ does carry there will be a $2$ in the hundreds, which $2b+1$ cannot match. This does not work.