4
$\begingroup$

The tag ''calculus'' may not fit for this question but I couldn't think of anything else. Please feel free to change it.

Suppose $a=0,a_{-1}a_{-2}a_{-3}\ldots$ and $b=0,b_{-1}b_{-2}b_{-3}\ldots$ are two decimal numbers. To be precise, I should have add ''representation of'' before ''decimal numbers'' but this is not of what the question is about.

How can I practically add and multiply $a$ and $b$?

If $a$ and $b$ are rational and thus periodic, you could answer, that I should convert them to fractions $a={a'\over a''}$ and $b={b'\over b''}$ and do the obvious thing, but I don't want to do this.

Starting with addition, the problem is about digit sums bigger then $10$. If $a=b=0,111\ldots$ you have no problems adding them digit by digit from the left to $a+b=0,222\ldots$. But when you have something like $a=0,0888\ldots$ and $0,0111\ldots$ you can't write down any digit of the sum until you know what comes next if you start from the left since there may occur a digit sum $>10$ as with $a=0,088890\ldots$ and $0,011110\ldots$, can you? What happens here exactly, if $a$ and $b$ are rational? How does the length of the period of $a+b$ relies to the period lengths of $a$ and $b$?

The problem gets more complicated, if you think of multiplication. For ''finite'' numbers like $a=b=0,2=0,200\ldots$ you just write down a multiplication table and that's it (despite the fact, that $0,2=0,1999\ldots$, but let's ignore this). But how about arbitrary or rational numbers? I have the impression, that the length of the period may be much much bigger in the product. Is there an upper bound depending on the period lengths of $a$ and $b$?

As you define a decimal number as a certain absolutely convergent row, you define the multiplication by the Cauchy product, but this doesn't help when you want to do multiplication practically. Is there an easy algorithm?

Here is a concrete challenge: Multiply $a=b=0,\overline{142857}$.

  • 0
    Good problem. The difficuties you mention are one reason that in the formal definition of real number, we do not use the seemingly sensible infinite decimal. Beside, it might upset the Martians, who have $17$ fingers and would think the definition is earthist.2012-05-29
  • 0
    $\TeX$ assumes the use of decimal points; decimal commas, as used in some countries, are treated as punctuation and thus lead to spurious spaces.2012-05-29
  • 0
    Given a fraction $\frac{p}{q}$ let $q'$ be the number obtained from $q$ by removing all factors of $2$ and $5$. Then the period of the decimal expansion of $\frac{p}{q}$ divides the value of the Carmichael function $\lambda(q)$ (http://en.wikipedia.org/wiki/Carmichael_function). So when adding or multiplying the period won't be substantially larger than the product of the periods of the individual terms, and will often be smaller.2012-05-29
  • 0
    The common way of adding decimal numbers is to use "excess-6" arithmetic, where 6 is added if the digit exceeds 9. There are various clever ways to do this, some more "clever" than they should be, but since the operation tends to be highly optimized the cleverness is usually merited.2012-05-29
  • 0
    @Daniel: You are talking about arithmetic operations on Binary-Coded Decimal (BCD) numbers, which have nothing to do with the subject of the OP.2012-05-29
  • 0
    You may be interested in [Bill Gosper's monograph on calculating with continued fractions](http://perl.plover.com/classes/cftalk/INFO/gosper.txt). I also have [a short and possibly intelligible summary](http://perl.plover.com/classes/cftalk/TALK/slide001.html).2012-05-29

1 Answers 1