Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Single digit Roman numeral

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...

posted 7mo ago by Arpad Horvath‭  ·  edited 7mo ago by Arpad Horvath‭

Answer
#5: Post edited by user avatar Arpad Horvath‭ · 2023-10-26T05:50:13Z (7 months ago)
  • # Haskell, 56 bytes
  • ```
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • No import needed.
  • ```
  • scanl(*)1$cycle[5,2]
  • ```
  • will give you the infinite list of [1,5,10,50...]. With
  • ```
  • length$takeWhile(/=n)"IVXLCDM"
  • ```
  • you will get the index of the element you would like to look up.
  • If you set
  • ```haskell
  • n='V'
  • ```
  • the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
  • # 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 infinite list of [1,5,10,50...]. With
  • ```
  • length$takeWhile(/=n)"IVXLCDM"
  • ```
  • you will get the index of the element you would like to look up.
  • If you set
  • ```haskell
  • n='V'
  • ```
  • the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
#4: Post edited by user avatar Arpad Horvath‭ · 2023-10-25T15:44:54Z (7 months ago)
  • # Haskell, 56 bytes
  • ```
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • ```
  • scanl(*)1$cycle[5,2]
  • ```
  • will give you the infinite list of [1,5,10,50...]. With
  • ```
  • length$takeWhile(/=n)"IVXLCDM"
  • ```
  • you will get the index of the element you would like to look up.
  • If you set
  • ```haskell
  • n='V'
  • ```
  • the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
  • # Haskell, 56 bytes
  • ```
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • No import needed.
  • ```
  • scanl(*)1$cycle[5,2]
  • ```
  • will give you the infinite list of [1,5,10,50...]. With
  • ```
  • length$takeWhile(/=n)"IVXLCDM"
  • ```
  • you will get the index of the element you would like to look up.
  • If you set
  • ```haskell
  • n='V'
  • ```
  • the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
#3: Post edited by user avatar Arpad Horvath‭ · 2023-10-25T15:19:00Z (7 months ago)
  • # Haskell, 56 bytes
  • ```haskell
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • If you set
  • ```haskell
  • n='V'
  • ```
  • you'll get 5.
  • # Haskell, 56 bytes
  • ```
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • ```
  • scanl(*)1$cycle[5,2]
  • ```
  • will give you the infinite list of [1,5,10,50...]. With
  • ```
  • length$takeWhile(/=n)"IVXLCDM"
  • ```
  • you will get the index of the element you would like to look up.
  • If you set
  • ```haskell
  • n='V'
  • ```
  • the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
#2: Post edited by user avatar Arpad Horvath‭ · 2023-10-25T15:14:07Z (7 months ago)
  • # Haskell, 56 bytes
  • ```haskell
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • # Haskell, 56 bytes
  • ```haskell
  • (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
  • ```
  • If you set
  • ```haskell
  • n='V'
  • ```
  • you'll get 5.
#1: Initial revision by user avatar Arpad Horvath‭ · 2023-10-25T15:11:18Z (7 months ago)
# Haskell, 56 bytes

```haskell
(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
```