Roman Numeral Function - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Roman Numeral Function (/thread-5536.html) |
Roman Numeral Function - smp - 01-17-2016 09:29 PM Here's a simple function I created. Get a Roman Numeral as output for an integer input. Invoke by RN(integer). Code:
This is pretty simple stuff, but I'm still learning PPL. UPDATE: I messed up and posted code that did not handle 40 properly. I've updated with the correct code. smp RE: Roman Numeral Function - John Colvin - 01-19-2016 09:46 PM Now all we need is the inverse function RN^(-1)(XLV) to convert from Roman numerals to integers. I think that would be more useful. RE: Roman Numeral Function - smp - 01-19-2016 10:12 PM (01-19-2016 09:46 PM)John Colvin Wrote: Now all we need is the inverse function RN^(-1)(XLV) to convert from Roman numerals to integers. I think that would be more useful. Cool idea! I'll give that some thought. Thanks! smp RE: Roman Numeral Function - Gerald H - 01-20-2016 05:56 AM Here is an economical Roman to Arabic converter: http://www.hpmuseum.org/forum/thread-1640.html?highlight=roman Perhaps someone could translate the programme into Prime? RE: Roman Numeral Function - Didier Lachieze - 01-20-2016 01:08 PM (01-20-2016 05:56 AM)Gerald H Wrote: Here is an economical Roman to Arabic converter: With some checks on the input: Code: EXPORT R→A(r) RE: Roman Numeral Function - Gerald H - 01-20-2016 04:09 PM Bravo, Didier! All numbers tested so far correct. I didn't really expect anyone to do this...at least not so quickly! RE: Roman Numeral Function - Didier Lachieze - 01-20-2016 05:11 PM And here is a program to convert from Arabic to Roman representation: Code: EXPORT A→R(N) RE: Roman Numeral Function - Gerald H - 01-21-2016 10:45 AM A very nice programme, Didier, which I have translated to the 49G here: http://www.hpmuseum.org/forum/thread-5567.html Having again looked at the Prime I despair of using it - the pale blue & orange smudges on the keyboard are just too unclear. On the 50G, 49G, 48G & 42S using reading glasses I can manage, so until HP improve visibility I'll leave Prime programming to you & your ilk. RE: Roman Numeral Function - DrD - 01-21-2016 11:49 AM I agree, those two are very nice complement of utility programs, Didier. You seem especially well talented with the Prime, so thanks for those, and all the help you have provided along the way! -Dale- RE: Roman Numeral Function - JMB - 01-21-2016 01:42 PM Hi! Here there is a slightly modified version of Didiers's A→R, that also give good results for N between 1 and 3999 Code: EXPORT A→R(N) |