ABACUS: MYSTERY OF THE BEAD
The Bead Unbaffled - An Abacus Manual

Decimal & Octal Conversion techniques - by Marcos Labriola

Hello People at SorobanAbacus

I would like to share with you a method to convert Octal to Decimal I developed last month. The conversion is done fully in-place and can be accomplished very quickly.

Conversion from Octal to Decimal

Enter the octal number on the abacus;
Set the current position, say P, at the leftmost digit of the number;
Repeat the following steps:

Step 1

If P is at the units rod, we're done. The converted number is on the abacus.


Step 2

Starting from the digit at P and going to the left, until the leftmost digit, subtract twice its value from the digit immediately to the right.


Step 3

Set P one rod to the right.

Now, we detail the steps with an example.

Suppose we wish to convert 3735 from octal to decimal. We begin by entering that number on the abacus and setting P to the rod with the left 3, which is the leftmost significant digit:

   P
0003735


Now we start doing the steps described above. Step 1 is skipped, as we
aren't at units rod. Step 2 asks us to subtract:

   P
0003735 (initial octal number)
0003135 (3x2 subtracted from the rod at right of P)


Step 3 asks us to move P to the right. After we do that, we continue with
the next round:

    P
0003135
0003115 (1x2 subtracted from the rod at right of P)
0002515 (3x2 subtracted from the next rod to the left)


And so on...

     P
0002515
0002513 (1x2)
0002413 (5x2, ten, properly positioned)
0002013 (2x2)


      P
0002013
(P reached units rod. This is the decimal number)

For big numbers, you could use a coin or a seed to remember P between rounds.

Please, let me know if you need some help and have fun!

Marcos Labriola
 

===============================================================================

Here is a method for converting Decimal to Octal:

It is similar to the above method with two differences:
- we add twice the number to the position at right and
- we use octal addition to build the result
 

Conversion from Decimal to Octal

Enter the decimal number on the abacus;
Set the current position, say P, at the leftmost digit of the number;
Repeat the following steps:

step 4: set P one rod to the right.


Now, we detail the steps with an example.

Suppose we wish to convert decimal 4567 to octal. We begin by entering that number on the abacus and setting P to the rod with the 4, which is the leftmost significant digit:

   P
0004567


Now we start doing the steps described above. Step 1 is skipped, since we don't need to normalize. Step 2 is also skipped, as we aren't at units rod. Step 3 asks us to add:

   P
0004567 (initial decimal number)
0005367 (4x2 added to the rod at right of P)
0005567 (2 added to the rod at right of P)


Let me explain this last addition of two. It was used to transform a decimal carry into an octal carry. This way, we can add octal numbers naturally on the abacus, as if we were working with decimal numbers, but always remembering to add 2 to the right whenever we carry to the left. Cascading carries don't happen in this step, so we don't worry about them for now.

As an alternative to adding 2 when we carry to the left, here's a small octal multiplication table that can be used instead: 4x2=10  5x2=12  6x2=14  7x2=16 ...and that's enough. 0,1,2,3 are like decimal and 8,9 never come.

Step 4 asks us to move P to the right. After we do that, we continue with the next round, skipping steps 1 and 2:

    P
0005567
0005687 (5x2 added to the rod at right of P, in octal)
0006887 (5x2 added to the next rod to the left, in octal)


For the next round we normalize (step 1) and skip step 2. Normalization can be thought as the execution of unprocessed carries due to the extended capacity of the decimal abacus in the context of octal arithmetic, which allows for redundant number representations. Hence, we can normalize by decimally adding 2 to every 8 or 9 digit to force the unprocessed carry. Notice that we don't have to add 2 again as a consequence of the carry, since we are doing it before.

     P
0006887
0006907
0007107


We can normalize in any order, as long as we avoid cascaded carries, which require special handling and will be studied on a separate method.

Now step 3:

     P
0007107
0007107 (0x2)
0007127 (1x2)
0008727 (7x2)


Next round: normalize

      P
0008727 (only leftmost digit requires normalization)
0010727


At step 2 we are at units rod. 10727 is the octal result.


Please, let me know if you need some help and have fun!

Marcos Labriola

 

Abacus: Mystery of the Bead
Advanced Abacus Techniques
Marcos Labriola, 2013