On Sep 4, nyec said:

>The program took a number sequence. For example <10-100>, reversed the digits
>and calculated the difference of the original number. So the calculations
>look like this: <10-01=9; 11-11=0; 12-21=9; 13-31=18; etc.>.

A number subtracted from its reverse yields a multiple of 9.

Notice that 52 - 25 = 27, which is 3*9.  Moreover, 3 = 5 - 2 (the
digits of the number).

Notice that 461 - 164 = 297, which is 3*99.  Moreover, 3 = 4 - 1.

Notice that 4321 - 1234 = 3087, which is (whew!) 3*999 + 1 * 90.
Moreover, 3 = 4 - 1, and 1 = 3 - 2.

Do you see the pattern here?  It's rather easy to prove mathematically:

  AB - BA = 10A + B - 10B - A = 9A - 9B = 9*(A-B)

which must be divisible by 9, and so on.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to