
6 Jul
2004
6 Jul
'04
2:13 a.m.
George Russell wrote:
The following declaration for a function for converting positive integers to Roman numerals is 181 characters long.
Is there a shorter one?
Yes, thanks to various contributors to this list, the shortest is now 148 characters!! roman=f 0;f a n|n<1=""|n>=t!!a=s!!a:f a(n-t!!a)|n+t!!b>=t!!a=s!!b:f a(n+t!!b)|1>0=f(a+1)n where b=2*div a 2+2;s="mdclxvi";t=[1000,500,100,50,10,5,1]