OFFSET
1,2
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..3999
Stephanus Gibbs, Roman Numeral and Date Conversion
Eric Weisstein's World of Mathematics, Roman Numerals
Wikipedia, Roman numerals
EXAMPLE
n=42 == XLII: a(42) = 'X' + 'L' + 'I' + 'I' = 10+50+1+1 = 62.
MAPLE
A093783 := proc(n) local r: r:=convert(n, roman): return add(convert(r[j], arabic), j=1..length(r)): end: seq(A093783(n), n=1..68); # Nathaniel Johnston, May 18 2011
MATHEMATICA
Total[#2 FromRomanNumeral[#1] & @@@ Tally[Characters@ RomanNumeral@ #]] & /@ Range@ 68 (* Michael De Vlieger, Sep 08 2015, Version 10.2 *)
PROG
(Haskell)
a093783 n = q 0 $ a061493 n where
q s 0 = s
q s x = q (s + [0, 1, 5, 10, 50, 100, 500, 1000] !! d') x'
where (x', d) = divMod x 10; d' = fromInteger d
-- Reinhard Zumkeller, Apr 14 2013
(HP 49G calculator)
::
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
;
;
Gerald Hillier, Sep 08 2015
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Reinhard Zumkeller, May 17 2004
STATUS
approved