1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need program for roman numerals

  1. Nov 24, 2007 #1
    In speed trials experienced operators of the abacus outperform western-style
    calculator users. Here we will teach the computer how to do basic arithmetic
    in the style of an early calculating machine, the Roman abacus, but it is
    unlikely to make the calculation any faster for the computer! The Roman
    numbering system used seven basic symbols
    Roman Numeral I V X L C D M
    Decimal Equivalent 1 5 10 50 100 500 1000
    Using these numerals numbers were represented by running the number of
    required symbols together in descending value. For example,
    XXXXVIII is 48
    The Roman abacus had a row of beads for each symbol. So 48 is represented
    as shown below. By using the V, L and D symbols, only a maximum of four
    beads per symbol were required to represent any number up to 4999 which
    was more than enough for day-to-day use.
    X • • • •
    V •
    I • • •
    To add to roman numbers using this abacus is both very simple and extremely
    efficient. For example to add 2738 and 1524 we begin by coding the numbers
    on the abacus
    M • • M •
    D • D •
    C • • C
    L • L
    X • • • X • •
    V V
    I • • • I • • • •
    2783 1524
    Now all the beads are placed together, giving
    M • • •
    D • •
    C • •
    L •
    X • • • • •
    I • • • • • • •
    All that remains is to perform a carry operation for each symbol. For symbols
    I, X, and C, whenever we have five beads then we must add one bead to the
    next symbol above and remove the five beads from the symbol in question.
    For symbols, V, L, and D we do the same whenever two or more beads are
    present. There is no carry operation for M since this is the highest symbol.
    So, for our example we begin with I, counting 7 beads. We remove five beads
    from I and add one bead to V. For V we have only one bead, so we do nothing.
    For X we have five beads, and so we remove all five beads and add one to L.
    We now have two beads under L and so we remove these and add one to C.
    Only 3 beads are counted under C and so we do nothing. The two beads under
    D are removed and one is added to M. All that remains is to read off the
    M • • • •
    C • • •
    V •
    I • •
    MMMMCCCVII = 4307
    Write a program that performs Roman abacus addition. Store the number of
    beads under each symbol in a single element of a 1-dimensional array. By
    creating a separate array for each complete number add the two numbers
    using the procedure outlined.
    Allow the user to enter the 2 decimal numbers to be added, which are to be
    first converted to Roman form and stored into the two arrays. Your program is
    to provide a graphical representation of the input numbers on an abacus,
    similar in form to that given above, and after each stage of the calculation. The
    final state of the abacus should be shown along with the answer as a decimal
    equivalent. Since the assignment tests for call by address use call by address
    to pass information from these functions back to main.
    Firstly, separate the problem into a number of functions, define an
    input/output specification for each function (including main) and design a
    flow-chart for each that implements its functionality.
  2. jcsd
  3. Nov 25, 2007 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    Was this intended as a joke? You are simply copying a homework problem as if you expect US to do it! I'm not getting a grade in the course so I am not going to do your homework for you- and you shouldn't want us to. If you have specific questions about the problem or what you have post them. We'll be happy to answer them.
  4. Jan 14, 2009 #3
    The Roman abacus was not quite as you describe, it did not have a row for each symbol you listed above. In particular the abacus had seven columns with two slots each one above the other for integers and these were annotated with the values for 1, 10 100 .... to 1,000,000, using unique symbols I cannot duplicate here. In other words, it had a decimal place value format where each decade was split into two slots, the lower slot having 4 beads, the upper slot one bead. The beads in the lower slots indicated a value of 1 for that positions decade and the bead in the upper slot was worth five of that decade. Thus each column could indicate 0-9 and the position from the right indicated the power of ten from 0 to 6. Thus the abacus could hold values from 0 to 10,000,000 - 1.

    One very useful feature of this bi-quinary decimal place value system, was that values written using the Roman numeral system could be transferred easily to the abacus. For example the value you used, 48 in Roman numerals XXXXVIII results in three beads moved up in the lower slot of column 1, and the one bead in the top slot of column 1 moved down (In the same manner as the Chinese abacus, counted beads are moved to the centre, or "heaven"). Then four beads are moved up in the lower slot of column 2.

    Calculations can be performed in the same manner as the Chinese and Japanese abacuses, carrying values from one column to next where necessary. When the calculation is completed, the values can then be transferred directly from the abacus to the written Roman number format. Values in th lower slots are copied as is using the appropriate Roman numeral for that column, and likewise, any counted beads in the upper slot are transferred using the appropriate 5 time numeral.

    If MMDCCXI (2718) is added to our 48 we get 2766 or MMDCCLXVI which on the abacus appears as

    Code (Text):
    | • | • | • | • |   |   |   |
    |   |   |   |   | • | • | • |
    --6---5---4---3---2---1---0-- Power of Ten
    |   |   |   | • | • | • | • |
    | • | • | • | • | • |   |   |
    | • | • | • |   |   | • | • |
    | • | • | • | • | • | • | • |
    | • | • | • | • | • | • | • |
    It should be noted that the use of the subtractive format of Roman numerals was not in general use by the Romans but developed more fully in the medieval period. This is clearly demonstrated by the numbering of gates in Rome's Colosseum which does not use this feature.

    The manner in which you describe the operation of adding two numbers is correct but the layout is not as you stated. To see a very good example look at the http://www.hh.schule.de/metalltechnik-didaktik/users/luetjens/abakus/rom-abakus-en.htm" [Broken].

    The Roman hand abacus also had two more columns for calculations with fractions. This second from the right and 2 slots but had 5 beads in the lower slot and 1 in the upper slot. This is because the Romans worked predominantly in twelfths. Most Roman measures were divided into twelfths, 12 uncia in a Pes (inches in a foot), 12 uncia in an As (ounces in a pound). Thus the bottom slot counted 0 to 5 twelfths, and the bead in the upper slot counted 6/12. Therefore this allowed them to count 0 to 11 twelfths, and then any more would carry to the units column.

    The first column was sometime a single slot with three symbols down the side and 4 beads in total, or three slots with one symbol for each and with one, one and two beads from top slot to the bottom. This is accepted as allowing fractions of the second column to be counted and the symbols for the top and middle slots indicate 1/2 and 1/4 of the next column or 1/2 and 1/4 of 1/12, i.e. 1/24 and 1/48. The bottom slot is said by some authorities to denote a count of thirds of the second column while I agree with the interpretation that these beads are used to count twelfths of column 2. Only this second arrangement allows for all values from 0/12 to 11/12 to be represented. If these lower beads count thirds (i.e. 1/3 and 2/3 of 1/12) then there is no way to represent 1/12, 2/12 and 5/12 of column 2, and it also produces illogical and redundant values of 13/12, 14/12 and 17/12 of column 2. To see a fuller explanation see the Wikipedia page on the http://en.wikipedia.org/wiki/Roman_abacus" [Broken] and in particular the section titled Symbols and Usage.

    As for a program to show the operation of a Roman abacus, I do know there is at least one already available on the web, but do not have a reference to it any longer. I believe it also implements the use of the fractional columns.
    Last edited by a moderator: May 3, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook