Posts by Arpad Horvath
Python 3.8+, 51 byte lambda n:((i:="IVXLCDM".index(n))%2*4+1)*10**(i//2) Testing the code: f=lambda n:((i:="IVXLCDM".index(n))%2*4+1)*10**(i//2) for s in "IVXLCDM": print(s, f(s)) T...
Haskell, 66 bytes -7 bytes thanks to Razetime import Data.Complex (\c->(<2).magnitude$(iterate(\z->z*z+c)c)!!16) I use the fact, that if the result is bigger than 2, it will be fore...
Python 3.8+, 219 bytes Short version: from itertools import combinations as c def m(w): for k in range(n:=len(w)): for y in c(range(n),k+1): s=[0]*n for x in y: for r in range(...
Python 3.8+, 577 bytes (was 634 than 591 bytes before) V="eéiíaáoóuúEÉIÍAÁOÓUÚ" r={"mé":("mo",0),"tú":("do",0),"sí":("a",1),"sé":("a",0),"muid":("ár",2),"sibh":("bhur",2),"siad":("a",2)} s=la...
Python, 220 bytes Works with Python 3.8 or newer. n=" IVXLCDM" x=("".join([n[(d:=ord(c)-32)//8]+n[d-8*(d//8)]for c in'&PW!H.!@/$HF$@G"H6"@7"03#P?%N%O%U%]%^%_&N&O!*!+!1!=!9!<!:!;...
Python, 104 bytes f=lambda n:"1.0000000.7272730.7285710.7368420.7437890.7491640.7533440.7566570.7593360.761542"[8*n-8:8*n] Try it online! Not too clever. I am curious whether it can be beaten ...
Haskell, 62 bytes (\n->(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")) No import needed. It just uses standard Prelude functions. scanl(*)1$cycle[5,2] will give you the infinit...
Haskell, 271 bytes import Data.Char import Data.List n=" IVXLCDM" r x=maximum[if(s`isInfixOf`x)then s else"A"|s<-words$concat$map(\x->(n!!div x 8):[(n!!(x-8*(div x 8)))])$map(\x->ord...