Post Reply 
(49G) Cross Sum of a Roman Number, OEIS A093783
09-08-2015, 03:37 PM (This post was last modified: 06-15-2017 01:46 PM by Gene.)
Post: #1
(49G) Cross Sum of a Roman Number, OEIS A093783
The programme finds the cross sum of the Roman integer represented by the Arabic input.

eg For input

1984

also known as

MCMLXXXIV

the programme returns

2186 = M+C+M+L+X+X+X+V+I

For more info see

http://oeis.org/A093783

Code:

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupQIsZero?
    caseSIZEERR
    FPTR2 ^Z>S
    Z0_
    SWAP
    DUPLEN$
    ZERO_DO
    DUP
    ISTOP-INDEX
    SUB$1#
    BINT48
    #-
    BINT4
    OVER#=
    OVER
    BINT9
    #=
    OR
    IT
    #2+
    FPTR2 ^#>Z
    Z10_
    INDEX@
    FPTR2 ^RP#
    FPTR2 ^RMULText
    ROT
    FPTR2 ^RADDext
    SWAPLOOP
    DROP
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)