Differences between revisions 11 and 12
 ⇤ ← Revision 11 as of 2007-09-05 21:54:23 → Size: 3711 Editor: RogerHui Comment: ← Revision 12 as of 2008-12-08 10:45:33 → ⇥ Size: 3712 Editor: anonymous Comment: converted to 1.6 markup Deletions are marked like this. Additions are marked like this. Line 59: Line 59: [[BR]] <
> Line 63: Line 63: * [:../Number in Words:Number in Words] [[BR]] * [[../Number in Words|Number in Words]] <
> Line 65: Line 65: [[BR]] <
>

rfd obtains Roman numerals from decimals, and dfr decimals from Roman numerals.

```dfr=: 3 : 0
i=. 'IVXLCDM' i. y
d=. i{1 5 10 50 100 500 1000
+/d*_1^i<}.i,_1
)

r100 =. <;._1 '  C CC CCC CD D DC DCC DCCC CM'
r10  =. <;._1 '  X XX XXX XL L LX LXX LXXX XC'
r1   =. <;._1 '  I II III IV V VI VII VIII IX'
R1000=: , r100 ,&.>/ r10 ,&.>/ r1

rfd=: 3 : 0
('M'\$~<.y%1000),R1000{::~1000|y
)```

A few examples, ending with a Roman multiplication table.

```   rfd 123
CXXIII
dfr 'CXXIII'
123

rfd 0

dfr ''
0

rfd&.> */~ 1+i.10
┌────┬─────┬─────┬──────┬────┬──────┬──────┬──────┬─────┬────┐
│I   │II   │III  │IV    │V   │VI    │VII   │VIII  │IX   │X   │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│II  │IV   │VI   │VIII  │X   │XII   │XIV   │XVI   │XVIII│XX  │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│III │VI   │IX   │XII   │XV  │XVIII │XXI   │XXIV  │XXVII│XXX │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│IV  │VIII │XII  │XVI   │XX  │XXIV  │XXVIII│XXXII │XXXVI│XL  │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│V   │X    │XV   │XX    │XXV │XXX   │XXXV  │XL    │XLV  │L   │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│VI  │XII  │XVIII│XXIV  │XXX │XXXVI │XLII  │XLVIII│LIV  │LX  │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│VII │XIV  │XXI  │XXVIII│XXXV│XLII  │XLIX  │LVI   │LXIII│LXX │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│VIII│XVI  │XXIV │XXXII │XL  │XLVIII│LVI   │LXIV  │LXXII│LXXX│
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│IX  │XVIII│XXVII│XXXVI │XLV │LIV   │LXIII │LXXII │LXXXI│XC  │
├────┼─────┼─────┼──────┼────┼──────┼──────┼──────┼─────┼────┤
│X   │XX   │XXX  │XL    │L   │LX    │LXX   │LXXX  │XC   │C   │
└────┴─────┴─────┴──────┴────┴──────┴──────┴──────┴─────┴────┘```