# 9 hidden in every number regardless of number of digits?

Let us consider a number, e.g. 1234

Now reverse the positions of the terminal digits, so we get 4231

4231-1234=2997 which is divisible by 9

i have seen this for n-digit numbers, where n ranges from 2 to 6

Is there any number which is contradicting this behavior irrespective of its number of digits?

Now coming back to the example,

Now 2997/9=333 is a palindrome

Another example 923456781-123456789=799999992

799999992/9=88888888

Is this also independent of the number of digits of the original number?

Let us consider :

95623-35629=59994/9=6666

The largest prime factor of 6666 is 101 which is a palindrome and a prime number.

Now 6666/101=66

Again 66/11(11 being the largest prime factor of 66) equals to 6 which is a palindrome.

Another example :

923456781-123456789=799999992/9=88888888

The largest prime factor of 88888888 is 137

88888888/137=648824/101(101 being largest prime factor of 648824)=6424/73(73 being largest prime factor of 6424) this in turn equals to 88 (a palindrome)

Finally, 88/11(11 being largest prime factor of 88 and a palindrome) equals to 8 which is also a palindrome.

Now as per (http://math.stackexchange.com/questions/200835/are-there-infinitely-many-super-palindromes), will it be correct to call 88888888 a super palindrome?

Can it be possible to call a number a super palindrome if it generates non palindromes along with palindromes, provided the non-palindromes finally generate using the method of division by largest prime factor, a palindrome other than 1?

-

The remainder of dividing a number by 9 is the same as dividing the sum of its digits by 9. This is one of the classic divisibility rules. The sum of digits is the same after you reverse the numbers, so the difference of the sums of digits will be zero. The difference of the numbers is therefore divisible by 9.

-

The key fact is that $9 \vert 10^a - 10^b$ for all $a$ and $b$. In particular, $9 \vert (10^k-1)$ for all $k$.

Any $n+1$ digit number is of the form $$s= a_n 10^n + a_{n-1} 10^{n-1} + \cdots + a_0$$ The new number is given by $$s_{\text{new}} = a_0 10^n + a_{n-1} 10^{n-1} + \cdots + a_{1} 10 + a_n$$ Hence, \begin{align} s - s_{\text{new}} & = a_n (10^n-1) + a_0 (1-10^n) = (10^{n}-1)(a_n-a_0) \end{align} Hence, $9 \vert (s-s_{\text{new}})$.

Note that $\vert a_n - a_0 \vert = d \in \{0,1,2,\ldots,9\}$ and $\dfrac{10^n-1}{9} = \underbrace{111\ldots 11}_{n \text{ ones}}$. Hence, if $\vert a_n - a_0 \vert = d$, then $$\vert s - s_{\text{new}} \vert = \underbrace{ddd\ldots dd}_{n \text{ d's}}$$ which is indeed more than a palindrome.

EDIT

In fact, the first half of your question is true in a more general setting. Consider a number $$s = a_n 10^n + a_{n-1} 10^{n-1} + \cdots + a_1 10 + a_0$$ Let $$s_{\text{new}} = b_n 10^n + b_{n-1} 10^{n-1} + \cdots + b_1 10 + b_0$$ where $\{b_k\}_{k=0}^n$ is a permutation of $\{a_k\}_{k=0}^n$. Then by the same argument as above we have that $9 \vert (s-s_{\text{new}})$

-
"Hence, if |an−a0|=d, then |s−snew|=ddd…ddn d's which is indeed more than a palindrome", please explain what do you mean by more than a palindrome? –  Pradip Saha Nov 2 '12 at 18:14
@PradipSaha $dd \ldots dd$ has all its digit the same. A palindrome need not have all its digit the same; for instance, $134757431$ is also a palindrome. –  user17762 Nov 2 '12 at 18:15
But a palindrome can have all its digits the same, it does not become a non-palindrome because of this feature in it? –  Pradip Saha Nov 2 '12 at 18:19
@PradipSaha Yes. It is still a palindrome. Thats why I said it is more than a palindrome. –  user17762 Nov 2 '12 at 18:21
So is |s−snew|=ddd…ddn d's a super palindrome? –  Pradip Saha Nov 2 '12 at 18:25

Remember that:

$$(ab)\mod c = (a\mod c)(b\mod c)$$

$$(a + b)\mod c = (a\mod c) + (b\mod c)$$

So take a base-10 number $a_1a_2\cdots a_n$ and rewrite it is:

$$a_1*10^{n-1}+a_2*10^{n-1}\cdots +a_n10^0$$

$$(a_1*10^{n-1}+a_2*10^{n-1}\cdots +a_n10^0)\mod 9 = ((a_1\mod9)\cdot(10\mod9)^{n-1}+(a_2\mod9)\cdot(10\mod9)^{n-2}\cdots(a_n\mod9)$$

Since $(10\mod9)=1$, this reduces to:

$$(a_1+a_2\cdots+a_n)\mod9$$

Since addition is commutative, the order of the digits does not matter. You could take a number, scramble its digits however you please, subtract, and the result will be divisible by 9.

Also see answers to this question.

-
I took an example based on your suggestion : –  Pradip Saha Nov 2 '12 at 22:19
Example : 845163279-216734985 = 628428294 / 9 = 69825366 / 298399 (298399 being largest prime factor of 69825366) = 234 / 13(13 being largest prime factor of 234) = 18 / 3( 3 being largest prime factor of 18) = 6 which is a palindrome, but 69825366 is a non-palindrome; so although by just scrambling the digits I can get the divisibility by 9 trait, I cannot though get the super palindrome behavior, please correct me if i am wrong.. –  Pradip Saha Nov 2 '12 at 22:27
@PradipSaha yes, you are right, the random scrambling will only apply to divisibility. –  jlovegren Nov 2 '12 at 23:32