Ok. I know this isn't a perl question, but I know that some of the monks here are very interessed and good att math so I thought this would be a good place fore this question.

Background:
First you take a 6 digit number and make a litteral reverse on that (345612 would be 216543). Then you take the original number and the reversed number and calculate the difference (345612 - 216543 = 129069). Then you remove a digit from the difference (remove the 6 near the end = 12909) and then calculate the sum of all the digits left (1+2+9+0+9 = 21) then you repete this stage on the result until you only get one digit left (2+1 = 3).And now comes the strange stuff. If you take 9 minus the digit you got (9 - 3) you will get the number you removed from the original difference.

NOTE: This works on any number that isn't symetric. And if you don't remove a 9.

So here comes the questions.
Why does this work?
Why do you always get the number you removed?
Is there any algorithem that makes a mathematical revers of the number?
(I only ask this becous I think it is a part of the solution)

I hope you can forgive me for posting non-perl questions.

// Martin

In reply to Math Question by Martin A

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.