09-08-2015, 03:37 PM
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
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
;
;