Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why?


A number is the sum of its digits, raised to the appropriate powers

    Sum(i=0..n, a[i]*10^i)
123, for example is 3 + 2 * 10 + 1 * 100.

A power of 10 (10^n) can be re written as

    (1 + 9 * Sum(i=0..n-1, 10^i). 
For example: 1000 = 1 + 999 = 1 + 900 + 90 + 9

When you subtract two numbers with the same digits, you end up being able to factor a nine out of these sums fairly easily.

I wrote a proof of the number - reverse(number) a while back. It can be found on archive.org

http://web.archive.org/web/20050314023901/http://jimfl.tense...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: