#[05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), <s>61</s> <s>9</s> 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ŽF¯L.XIå Whopping \$\color{green}{\textrm{-52 bytes}}\$ thanks to *@Adnan*, because apparently 05AB1E's Roman Number builtin wasn't documented, haha.. xD [Try it online](https://tio.run/##yy9OTMpM/f//6F63Q@t99CI8Dy/9/9/X19fZN8LZMwIA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKS/f@je90OrffRi6g8vPS/zv9oJV9fX2ffCGfPCCUdJV9n54iICM8wINPZ1wfIDPP09ARyXKBiQLYCUIMnTNwzDKQLyAXpBQIgBdIEFgzzVIoFAA). **Explanation:** <!-- language-all: lang-python --> ŽF¯ # Push comressed integer 3999 L # Create a list in the range [1,3999] .X # Convert each integer in this list to a roman number string Iå # Check if the input is in this list # (and output the result implicitly) <!-- language-all: none --> [See this 05AB1E tip of mine (section *How to compress large integers?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `ŽF¯` is `3999`. ---------- **Original 61 bytes answer:** •1∞Γ'иÛnuÞ\₂…•Ž8вв€SÐ)v.•6#&‘нδ•u3ôNèyè}'M3L×)Rεõš}`3Fâ}€˜JIå [Try it online](https://tio.run/##AXgAh/9vc2FiaWX//@KAojHiiJ7OkyfQuMObbnXDnlzigoLigKbigKLFvTjQstCy4oKsU8OQKXYu4oCiNiMm4oCY0L3OtOKAonUzw7ROw6h5w6h9J00zTMOXKVLOtcO1xaF9YDNGw6J94oKsy5xKScOl//9NTU1DTVhDSVg) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKS/f9HDYsMH3XMOzdZ/cKOw7PzSg/Pi3nU1PSoYRlQ4uheiwubLmx61LQm@PAEzTI9oJCZstqjhhkX9p7bAuSUGh/e4nd4ReXhFbXqvsY@h6drBp3benjr0YW1CcZuhxfVAjWenuNVeXjpf53/0Uq@vr7OvhHOnhFKOkq@zs4RERGeYUCms68PkBnm6ekJ5LhAxYBsBaAGT5i4ZxhIF5AL0gsEQAqkCSwY5qkUCwA). **Explanation:** <!-- language-all: lang-python --> •1∞Γ'иÛnuÞ\₂…• '# Push compressed integer 397940501547566186191992778 Ž8в # Push compressed integer 2112 в # Convert the integer to Base-2112 as list: # [1,11,111,12,2,21,211,2111,10] €S # Convert each number to a list of digits Ð # Triplicate this list ) # And wrap it into a list of lists (of lists) v # Loop `y` over each these three lists: .•6#&‘нδ• # Push compressed string "xivcxlmcd" u # Uppercased 3ô # And split into parts of size 3: ["XIV","CXL","MCD"] Nè # Use the loop index to get the current part yè # And index the list of lists of digits into this string }'M '# After the loop: push "M" 3L # Push list [1,2,3] × # Repeat the "M" that many times: ["M","MM","MMM"] ) # Wrap all lists on the stack into a list: # [[["I"],["I","I"],["I","I","I"],["I","V"],["V"],["V","I"],["V","I","I"],["V","I","I","I"],["I","X"]],[["X"],["X","X"],["X","X","X"],["X","L"],["L"],["L","X"],["L","X","X"],["L","X","X","X"],["X","C"]],[["C"],["C","C"],["C","C","C"],["C","D"],["D"],["D","C"],["D","C","C"],["D","C","C","C"],["C","M"]],["M","MM","MMM"]] R # Reverse this list εõš} # Prepend an empty string "" before each inner list ` # Push the four lists onto the stack 3F # Loop 3 times: â # Take the cartesian product of the two top lists }€˜ # After the loop: flatten each inner list J # Join each inner list together to a single string Iå # And check if the input is in this list # (after which the result is output implicitly) [See this 05AB1E tip of mine (sections *How to compress strings not part of the dictionary?*, *How to compress large integers?*, and *How to compress integer lists?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why: - `•1∞Γ'иÛnuÞ\₂…•` is `397940501547566186191992778` - `Ž8в` is `2112` - `•1∞Γ'иÛnuÞ\₂…•Ž8вв` is `[1,11,111,12,2,21,211,2111,10]` - `.•6#&‘нδ•` is `"xivcxlmcd"`