When in Rome, Count as Romans do?
Clash Royale CLAN TAG#URR8PPP
up vote
18
down vote
favorite
Background
This challenge is inspired by this website, which published the following diagram:
This diagram shows us that the longest Roman Numeral expression under 250 is that of 188, which requires 9 numerals to express.
Challenge
The standard symbols used to express most Roman Numerals are the following: I
, V
, X
, L
, C
, D
, M
, where the characters' numeric values are M
=1000, D
=500, C
=100, L
=50, X
=10, V
=5, I
=1.
In this challenge, your goal is to, given an positive integer n, compute the number of valid Roman Numeral representations that can be composed through concatenating n of the standard symbols.
Then, your program must output the result of this computation!
Input: A positive integer n.
Output: The number of valid roman numeral expressions of length n.
Rules for Roman Numeral Expressions
Roman Numerals originally only had "additive" pairing, meaning that numerals were always written in descending order, and the sum of the values of all the numerals was the value of the number.
Later on, subtractive pairing, the use of placing a smaller numeral in front of a larger in order to subtract the smaller from the larger, became commonplace to shorten Roman Numeral expressions. Subtractive pairs cannot be chained, like in the following invalid expression: IXL
.
The following are the modern day rules for additive and subtractive pairing.
- Only one I, X, and C can be used as the leading numeral in part of a subtractive pair.
- I can only be placed before V or X in a subtractive pair.
- X can only be placed before L or C in a subtractive pair.
- C can only be placed before D or M in a subtractive pair.
- Other than subtractive pairs, numerals must be in descending order (meaning that if you drop the leading numeral of each subtractive pair, then the numerals will be in descending order).
- M, C, and X cannot be equalled or exceeded by smaller denominations.
- D, L, and V can each only appear once.
- Only M can be repeated 4 or more times.
Further Notes
We will not be using the bar notation; rather, we will simply add more Ms to express any number.
These are the only rules that we will follow for our roman numerals. That means that odd expressions, such as
IVI
, will also be considered valid in our system.Also remember that we are not counting the number of numbers that have expressions of length n, since some numbers have multiple expressions. Instead, we are solely counting the number of valid expressions.
Test Cases
1
â 7
2
â 31
3
â 105
I checked the above by hand, so please make sure to double check the test cases, and add more if you can!
Winning Criteria
This is a code-golf challenge, so have fun! I will only accept solutions that can handle at least inputs from 1 through 9. Any more is bonus!
Edit
As requested by commenters, find below, or at this pastebin link, the 105 combos I counted for n=3
III
IVI
IXI
IXV
IXX
VII
XII
XIV
XIX
XVI
XXI
XXV
XXX
XLI
XLV
XLX
XCI
XCV
XCX
XCL
XCC
LII
LIV
LIX
LVI
LXI
LXV
LXX
CII
CIV
CIX
CVI
CXI
CXV
CXX
CXL
CXC
CLI
CLV
CLX
CCI
CCV
CCX
CCL
CCC
CDI
CDV
CDX
CDL
CDC
CMI
CMV
CMX
CML
CMC
CMD
CMM
DII
DIV
DIX
DVI
DXI
DXV
DXX
DXL
DXC
DLI
DLV
DLX
DCI
DCV
DCX
DCL
DCC
MII
MIV
MIX
MVI
MXI
MXV
MXX
MXL
MXC
MLI
MLV
MLX
MCI
MCV
MCX
MCL
MCC
MCD
MCM
MDI
MDV
MDX
MDL
MDC
MMI
MMV
MMX
MML
MMC
MMD
MMM
Edit 2:
Use the following non-golfed code, as courtesy of Jonathan Allan to check your results.
Edit 3:
I apologize for all of the errors in this challenge. I'll make sure to do a better job next time!
code-golf roman-numerals
add a comment |Â
up vote
18
down vote
favorite
Background
This challenge is inspired by this website, which published the following diagram:
This diagram shows us that the longest Roman Numeral expression under 250 is that of 188, which requires 9 numerals to express.
Challenge
The standard symbols used to express most Roman Numerals are the following: I
, V
, X
, L
, C
, D
, M
, where the characters' numeric values are M
=1000, D
=500, C
=100, L
=50, X
=10, V
=5, I
=1.
In this challenge, your goal is to, given an positive integer n, compute the number of valid Roman Numeral representations that can be composed through concatenating n of the standard symbols.
Then, your program must output the result of this computation!
Input: A positive integer n.
Output: The number of valid roman numeral expressions of length n.
Rules for Roman Numeral Expressions
Roman Numerals originally only had "additive" pairing, meaning that numerals were always written in descending order, and the sum of the values of all the numerals was the value of the number.
Later on, subtractive pairing, the use of placing a smaller numeral in front of a larger in order to subtract the smaller from the larger, became commonplace to shorten Roman Numeral expressions. Subtractive pairs cannot be chained, like in the following invalid expression: IXL
.
The following are the modern day rules for additive and subtractive pairing.
- Only one I, X, and C can be used as the leading numeral in part of a subtractive pair.
- I can only be placed before V or X in a subtractive pair.
- X can only be placed before L or C in a subtractive pair.
- C can only be placed before D or M in a subtractive pair.
- Other than subtractive pairs, numerals must be in descending order (meaning that if you drop the leading numeral of each subtractive pair, then the numerals will be in descending order).
- M, C, and X cannot be equalled or exceeded by smaller denominations.
- D, L, and V can each only appear once.
- Only M can be repeated 4 or more times.
Further Notes
We will not be using the bar notation; rather, we will simply add more Ms to express any number.
These are the only rules that we will follow for our roman numerals. That means that odd expressions, such as
IVI
, will also be considered valid in our system.Also remember that we are not counting the number of numbers that have expressions of length n, since some numbers have multiple expressions. Instead, we are solely counting the number of valid expressions.
Test Cases
1
â 7
2
â 31
3
â 105
I checked the above by hand, so please make sure to double check the test cases, and add more if you can!
Winning Criteria
This is a code-golf challenge, so have fun! I will only accept solutions that can handle at least inputs from 1 through 9. Any more is bonus!
Edit
As requested by commenters, find below, or at this pastebin link, the 105 combos I counted for n=3
III
IVI
IXI
IXV
IXX
VII
XII
XIV
XIX
XVI
XXI
XXV
XXX
XLI
XLV
XLX
XCI
XCV
XCX
XCL
XCC
LII
LIV
LIX
LVI
LXI
LXV
LXX
CII
CIV
CIX
CVI
CXI
CXV
CXX
CXL
CXC
CLI
CLV
CLX
CCI
CCV
CCX
CCL
CCC
CDI
CDV
CDX
CDL
CDC
CMI
CMV
CMX
CML
CMC
CMD
CMM
DII
DIV
DIX
DVI
DXI
DXV
DXX
DXL
DXC
DLI
DLV
DLX
DCI
DCV
DCX
DCL
DCC
MII
MIV
MIX
MVI
MXI
MXV
MXX
MXL
MXC
MLI
MLV
MLX
MCI
MCV
MCX
MCL
MCC
MCD
MCM
MDI
MDV
MDX
MDL
MDC
MMI
MMV
MMX
MML
MMC
MMD
MMM
Edit 2:
Use the following non-golfed code, as courtesy of Jonathan Allan to check your results.
Edit 3:
I apologize for all of the errors in this challenge. I'll make sure to do a better job next time!
code-golf roman-numerals
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20
add a comment |Â
up vote
18
down vote
favorite
up vote
18
down vote
favorite
Background
This challenge is inspired by this website, which published the following diagram:
This diagram shows us that the longest Roman Numeral expression under 250 is that of 188, which requires 9 numerals to express.
Challenge
The standard symbols used to express most Roman Numerals are the following: I
, V
, X
, L
, C
, D
, M
, where the characters' numeric values are M
=1000, D
=500, C
=100, L
=50, X
=10, V
=5, I
=1.
In this challenge, your goal is to, given an positive integer n, compute the number of valid Roman Numeral representations that can be composed through concatenating n of the standard symbols.
Then, your program must output the result of this computation!
Input: A positive integer n.
Output: The number of valid roman numeral expressions of length n.
Rules for Roman Numeral Expressions
Roman Numerals originally only had "additive" pairing, meaning that numerals were always written in descending order, and the sum of the values of all the numerals was the value of the number.
Later on, subtractive pairing, the use of placing a smaller numeral in front of a larger in order to subtract the smaller from the larger, became commonplace to shorten Roman Numeral expressions. Subtractive pairs cannot be chained, like in the following invalid expression: IXL
.
The following are the modern day rules for additive and subtractive pairing.
- Only one I, X, and C can be used as the leading numeral in part of a subtractive pair.
- I can only be placed before V or X in a subtractive pair.
- X can only be placed before L or C in a subtractive pair.
- C can only be placed before D or M in a subtractive pair.
- Other than subtractive pairs, numerals must be in descending order (meaning that if you drop the leading numeral of each subtractive pair, then the numerals will be in descending order).
- M, C, and X cannot be equalled or exceeded by smaller denominations.
- D, L, and V can each only appear once.
- Only M can be repeated 4 or more times.
Further Notes
We will not be using the bar notation; rather, we will simply add more Ms to express any number.
These are the only rules that we will follow for our roman numerals. That means that odd expressions, such as
IVI
, will also be considered valid in our system.Also remember that we are not counting the number of numbers that have expressions of length n, since some numbers have multiple expressions. Instead, we are solely counting the number of valid expressions.
Test Cases
1
â 7
2
â 31
3
â 105
I checked the above by hand, so please make sure to double check the test cases, and add more if you can!
Winning Criteria
This is a code-golf challenge, so have fun! I will only accept solutions that can handle at least inputs from 1 through 9. Any more is bonus!
Edit
As requested by commenters, find below, or at this pastebin link, the 105 combos I counted for n=3
III
IVI
IXI
IXV
IXX
VII
XII
XIV
XIX
XVI
XXI
XXV
XXX
XLI
XLV
XLX
XCI
XCV
XCX
XCL
XCC
LII
LIV
LIX
LVI
LXI
LXV
LXX
CII
CIV
CIX
CVI
CXI
CXV
CXX
CXL
CXC
CLI
CLV
CLX
CCI
CCV
CCX
CCL
CCC
CDI
CDV
CDX
CDL
CDC
CMI
CMV
CMX
CML
CMC
CMD
CMM
DII
DIV
DIX
DVI
DXI
DXV
DXX
DXL
DXC
DLI
DLV
DLX
DCI
DCV
DCX
DCL
DCC
MII
MIV
MIX
MVI
MXI
MXV
MXX
MXL
MXC
MLI
MLV
MLX
MCI
MCV
MCX
MCL
MCC
MCD
MCM
MDI
MDV
MDX
MDL
MDC
MMI
MMV
MMX
MML
MMC
MMD
MMM
Edit 2:
Use the following non-golfed code, as courtesy of Jonathan Allan to check your results.
Edit 3:
I apologize for all of the errors in this challenge. I'll make sure to do a better job next time!
code-golf roman-numerals
Background
This challenge is inspired by this website, which published the following diagram:
This diagram shows us that the longest Roman Numeral expression under 250 is that of 188, which requires 9 numerals to express.
Challenge
The standard symbols used to express most Roman Numerals are the following: I
, V
, X
, L
, C
, D
, M
, where the characters' numeric values are M
=1000, D
=500, C
=100, L
=50, X
=10, V
=5, I
=1.
In this challenge, your goal is to, given an positive integer n, compute the number of valid Roman Numeral representations that can be composed through concatenating n of the standard symbols.
Then, your program must output the result of this computation!
Input: A positive integer n.
Output: The number of valid roman numeral expressions of length n.
Rules for Roman Numeral Expressions
Roman Numerals originally only had "additive" pairing, meaning that numerals were always written in descending order, and the sum of the values of all the numerals was the value of the number.
Later on, subtractive pairing, the use of placing a smaller numeral in front of a larger in order to subtract the smaller from the larger, became commonplace to shorten Roman Numeral expressions. Subtractive pairs cannot be chained, like in the following invalid expression: IXL
.
The following are the modern day rules for additive and subtractive pairing.
- Only one I, X, and C can be used as the leading numeral in part of a subtractive pair.
- I can only be placed before V or X in a subtractive pair.
- X can only be placed before L or C in a subtractive pair.
- C can only be placed before D or M in a subtractive pair.
- Other than subtractive pairs, numerals must be in descending order (meaning that if you drop the leading numeral of each subtractive pair, then the numerals will be in descending order).
- M, C, and X cannot be equalled or exceeded by smaller denominations.
- D, L, and V can each only appear once.
- Only M can be repeated 4 or more times.
Further Notes
We will not be using the bar notation; rather, we will simply add more Ms to express any number.
These are the only rules that we will follow for our roman numerals. That means that odd expressions, such as
IVI
, will also be considered valid in our system.Also remember that we are not counting the number of numbers that have expressions of length n, since some numbers have multiple expressions. Instead, we are solely counting the number of valid expressions.
Test Cases
1
â 7
2
â 31
3
â 105
I checked the above by hand, so please make sure to double check the test cases, and add more if you can!
Winning Criteria
This is a code-golf challenge, so have fun! I will only accept solutions that can handle at least inputs from 1 through 9. Any more is bonus!
Edit
As requested by commenters, find below, or at this pastebin link, the 105 combos I counted for n=3
III
IVI
IXI
IXV
IXX
VII
XII
XIV
XIX
XVI
XXI
XXV
XXX
XLI
XLV
XLX
XCI
XCV
XCX
XCL
XCC
LII
LIV
LIX
LVI
LXI
LXV
LXX
CII
CIV
CIX
CVI
CXI
CXV
CXX
CXL
CXC
CLI
CLV
CLX
CCI
CCV
CCX
CCL
CCC
CDI
CDV
CDX
CDL
CDC
CMI
CMV
CMX
CML
CMC
CMD
CMM
DII
DIV
DIX
DVI
DXI
DXV
DXX
DXL
DXC
DLI
DLV
DLX
DCI
DCV
DCX
DCL
DCC
MII
MIV
MIX
MVI
MXI
MXV
MXX
MXL
MXC
MLI
MLV
MLX
MCI
MCV
MCX
MCL
MCC
MCD
MCM
MDI
MDV
MDX
MDL
MDC
MMI
MMV
MMX
MML
MMC
MMD
MMM
Edit 2:
Use the following non-golfed code, as courtesy of Jonathan Allan to check your results.
Edit 3:
I apologize for all of the errors in this challenge. I'll make sure to do a better job next time!
code-golf roman-numerals
edited Aug 11 at 0:15
asked Aug 10 at 15:03
Rushabh Mehta
523118
523118
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20
add a comment |Â
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
3
down vote
accepted
Retina, 111 bytes
~(`.+
*$(CM)CDXCXCXCXLIXIXIXIVII
.(.)
.+ö$$&$ö$$&$1$ö$$&$&öL`.0,$+böD`ö
ö$
ö.+ö$$&$ö$$&IöL`[A-Z]$+böD`ö.+
Try it online! This is a complete rewrite as I misunderstood rule 1. to mean that you could only use one each of subtractive I
, X
and C
. Explanation: The first part of the script expands the input into a string of CM
pairs followed by the other possible subtractive pairs. Each pair is optional, and the first character of each pair is also optional within the pair. The third stage then expands the list of pairs into a list of Retina commands that take the input and create three copies with the option of the second or both characters from the pair, then trims and deduplicates the results. The final stage then appends code to perform the final tasks: first to expand the input to possibly add a final I
, then to filter out results of the wrong length, then to deduplicate the results, and finally to count the results. The resulting Retina script is then evaluated.
Note: In theory 15 bytes could be saved from the end of the 4th line but this makes the script too slow to demonstrate on TIO even for n=1
.
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
add a comment |Â
up vote
5
down vote
Python 2, 177 168 162 bytes
import re,itertools as q
f=lambda n:sum(None!=re.match("^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$",(''.join(m)))for m in q.product('MDCLXVI',repeat=n))
Try it online!
I'm pretty new, help me golf this! This checks for actual roman numerals, the regex needs to be adjusted to account for the odd cases such as IVI
-9 bytes thanks to @Dead Possum!
-6 bytes thanks to @ovs
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
This doesn't seem to give the right answer for 3.93
instead of105
â Jo King
Aug 11 at 2:53
 |Â
show 5 more comments
up vote
3
down vote
JavaScript (ES7), 133 bytes
Edit: Fixed to match the results returned by Jonathan Allan's code, which was given as a reference implementation by the OP.
n=>[...Array(m=k=7**n)].reduce(s=>s+/^1*5?40,33?20,36?00,3$/.test((--k+m).toString(7).replace(/0[62]|2[34]|4[51]/g,s=>s[1])),0)
Try it online!
How?
1) We generate all numbers of $N$ digits in base 7 with an extra leading $1$:
[...Array(m = k = 7 ** n)].reduce(s => ⦠(--k + m).toString(7) â¦, 0)
From now on, each digit will be interpreted as a Roman numeral symbol:
$$beginarray0longleftrightarrow textI, & 1longleftrightarrow textM, & 2longleftrightarrow textX, & 3longleftrightarrow textL,\
4longleftrightarrow textC, & 5longleftrightarrow textD, & 6longleftrightarrow textV
endarray$$
2) We replace all valid subtractive pairs of the form AB
with B
:
.replace(/0[62]|2[34]|4[51]/g, s => s[1])) // in the code
.replace(/I[VX]|X[LC]|C[DM]/g, s => s[1])) // with Roman symbols
Examples:
XLIXIV
becomesLXV
XIIV
becomesXIV
, leaving aI
that will make the next test failIC
remains unchanged, which also leaves an invalidI
in place
3) We check that the remaining symbols are in the correct order and do not appear more times than they're allowed to:
/^1*5?40,33?20,36?00,3$/.test(â¦) // in the code
/^M*D?C0,3L?X0,3V?I0,3$/.test(â¦) // with Roman symbols
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
add a comment |Â
up vote
0
down vote
C, 150 123 bytes
I didn't read the description closely enough, so this produces the number of standard Roman numerals (where expressions like IVI
aren't counted). Since I put some effort into it, I thought I would share anyway.
#define F(X) for(X=10;X--;)
x=0,1,2,3,2,1,2,3,4,2;f(i,o,a,b,c)for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];return o;
Original (150 bytes):
#define F(X) for(X=10;X--;)
i,o,a,b,c,x=0,1,2,3,2,1,2,3,4,2;main()scanf("%i",&i);for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];printf("%in",o);
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
I think you can remove the space betweenF(X)
andfor(X=10;X--;)
â Zacharý
Aug 12 at 17:10
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Retina, 111 bytes
~(`.+
*$(CM)CDXCXCXCXLIXIXIXIVII
.(.)
.+ö$$&$ö$$&$1$ö$$&$&öL`.0,$+böD`ö
ö$
ö.+ö$$&$ö$$&IöL`[A-Z]$+böD`ö.+
Try it online! This is a complete rewrite as I misunderstood rule 1. to mean that you could only use one each of subtractive I
, X
and C
. Explanation: The first part of the script expands the input into a string of CM
pairs followed by the other possible subtractive pairs. Each pair is optional, and the first character of each pair is also optional within the pair. The third stage then expands the list of pairs into a list of Retina commands that take the input and create three copies with the option of the second or both characters from the pair, then trims and deduplicates the results. The final stage then appends code to perform the final tasks: first to expand the input to possibly add a final I
, then to filter out results of the wrong length, then to deduplicate the results, and finally to count the results. The resulting Retina script is then evaluated.
Note: In theory 15 bytes could be saved from the end of the 4th line but this makes the script too slow to demonstrate on TIO even for n=1
.
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
add a comment |Â
up vote
3
down vote
accepted
Retina, 111 bytes
~(`.+
*$(CM)CDXCXCXCXLIXIXIXIVII
.(.)
.+ö$$&$ö$$&$1$ö$$&$&öL`.0,$+böD`ö
ö$
ö.+ö$$&$ö$$&IöL`[A-Z]$+böD`ö.+
Try it online! This is a complete rewrite as I misunderstood rule 1. to mean that you could only use one each of subtractive I
, X
and C
. Explanation: The first part of the script expands the input into a string of CM
pairs followed by the other possible subtractive pairs. Each pair is optional, and the first character of each pair is also optional within the pair. The third stage then expands the list of pairs into a list of Retina commands that take the input and create three copies with the option of the second or both characters from the pair, then trims and deduplicates the results. The final stage then appends code to perform the final tasks: first to expand the input to possibly add a final I
, then to filter out results of the wrong length, then to deduplicate the results, and finally to count the results. The resulting Retina script is then evaluated.
Note: In theory 15 bytes could be saved from the end of the 4th line but this makes the script too slow to demonstrate on TIO even for n=1
.
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Retina, 111 bytes
~(`.+
*$(CM)CDXCXCXCXLIXIXIXIVII
.(.)
.+ö$$&$ö$$&$1$ö$$&$&öL`.0,$+böD`ö
ö$
ö.+ö$$&$ö$$&IöL`[A-Z]$+böD`ö.+
Try it online! This is a complete rewrite as I misunderstood rule 1. to mean that you could only use one each of subtractive I
, X
and C
. Explanation: The first part of the script expands the input into a string of CM
pairs followed by the other possible subtractive pairs. Each pair is optional, and the first character of each pair is also optional within the pair. The third stage then expands the list of pairs into a list of Retina commands that take the input and create three copies with the option of the second or both characters from the pair, then trims and deduplicates the results. The final stage then appends code to perform the final tasks: first to expand the input to possibly add a final I
, then to filter out results of the wrong length, then to deduplicate the results, and finally to count the results. The resulting Retina script is then evaluated.
Note: In theory 15 bytes could be saved from the end of the 4th line but this makes the script too slow to demonstrate on TIO even for n=1
.
Retina, 111 bytes
~(`.+
*$(CM)CDXCXCXCXLIXIXIXIVII
.(.)
.+ö$$&$ö$$&$1$ö$$&$&öL`.0,$+böD`ö
ö$
ö.+ö$$&$ö$$&IöL`[A-Z]$+böD`ö.+
Try it online! This is a complete rewrite as I misunderstood rule 1. to mean that you could only use one each of subtractive I
, X
and C
. Explanation: The first part of the script expands the input into a string of CM
pairs followed by the other possible subtractive pairs. Each pair is optional, and the first character of each pair is also optional within the pair. The third stage then expands the list of pairs into a list of Retina commands that take the input and create three copies with the option of the second or both characters from the pair, then trims and deduplicates the results. The final stage then appends code to perform the final tasks: first to expand the input to possibly add a final I
, then to filter out results of the wrong length, then to deduplicate the results, and finally to count the results. The resulting Retina script is then evaluated.
Note: In theory 15 bytes could be saved from the end of the 4th line but this makes the script too slow to demonstrate on TIO even for n=1
.
edited Aug 11 at 15:23
answered Aug 10 at 20:26
Neil
74.3k743169
74.3k743169
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
add a comment |Â
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
@JonathanAllan Ah, then you're including multiple subtractive pairs with the same leading numeral, which is wrong.
â Neil
Aug 10 at 23:27
2
2
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
@JonathanAllan New rewrite, coincidentally for the exact same byte count!
â Neil
Aug 11 at 15:24
add a comment |Â
up vote
5
down vote
Python 2, 177 168 162 bytes
import re,itertools as q
f=lambda n:sum(None!=re.match("^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$",(''.join(m)))for m in q.product('MDCLXVI',repeat=n))
Try it online!
I'm pretty new, help me golf this! This checks for actual roman numerals, the regex needs to be adjusted to account for the odd cases such as IVI
-9 bytes thanks to @Dead Possum!
-6 bytes thanks to @ovs
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
This doesn't seem to give the right answer for 3.93
instead of105
â Jo King
Aug 11 at 2:53
 |Â
show 5 more comments
up vote
5
down vote
Python 2, 177 168 162 bytes
import re,itertools as q
f=lambda n:sum(None!=re.match("^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$",(''.join(m)))for m in q.product('MDCLXVI',repeat=n))
Try it online!
I'm pretty new, help me golf this! This checks for actual roman numerals, the regex needs to be adjusted to account for the odd cases such as IVI
-9 bytes thanks to @Dead Possum!
-6 bytes thanks to @ovs
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
This doesn't seem to give the right answer for 3.93
instead of105
â Jo King
Aug 11 at 2:53
 |Â
show 5 more comments
up vote
5
down vote
up vote
5
down vote
Python 2, 177 168 162 bytes
import re,itertools as q
f=lambda n:sum(None!=re.match("^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$",(''.join(m)))for m in q.product('MDCLXVI',repeat=n))
Try it online!
I'm pretty new, help me golf this! This checks for actual roman numerals, the regex needs to be adjusted to account for the odd cases such as IVI
-9 bytes thanks to @Dead Possum!
-6 bytes thanks to @ovs
Python 2, 177 168 162 bytes
import re,itertools as q
f=lambda n:sum(None!=re.match("^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$",(''.join(m)))for m in q.product('MDCLXVI',repeat=n))
Try it online!
I'm pretty new, help me golf this! This checks for actual roman numerals, the regex needs to be adjusted to account for the odd cases such as IVI
-9 bytes thanks to @Dead Possum!
-6 bytes thanks to @ovs
edited Aug 10 at 17:44
answered Aug 10 at 16:36
Easton Bornemeier
29116
29116
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
This doesn't seem to give the right answer for 3.93
instead of105
â Jo King
Aug 11 at 2:53
 |Â
show 5 more comments
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
This doesn't seem to give the right answer for 3.93
instead of105
â Jo King
Aug 11 at 2:53
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with
^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
Yeah I think the n=3 case might be wrong in the example. I was originally getting 93 with
^M*(CM|CD|D?C0,3)(XC|XL|L?X0,3)(IX|IV|V?I0,3)$
â Easton Bornemeier
Aug 10 at 16:54
171 bytes
â Dead Possum
Aug 10 at 16:55
171 bytes
â Dead Possum
Aug 10 at 16:55
1
1
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
@JonathanAllan I spent around two days asking around on Math stackexchange trying to make sure these rules made sense. Guess I didn't do enough :(
â Rushabh Mehta
Aug 10 at 18:00
1
1
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
@RushabhMehta This is a very well formatted challenge and fun to program, don't feel bad about an unfortunate nuance in nitty-gritty of roman numeral definition. It is your challenge, specify it as you see fit. it is workable in the other sense, just more difficult
â Easton Bornemeier
Aug 10 at 18:31
1
1
This doesn't seem to give the right answer for 3.
93
instead of 105
â Jo King
Aug 11 at 2:53
This doesn't seem to give the right answer for 3.
93
instead of 105
â Jo King
Aug 11 at 2:53
 |Â
show 5 more comments
up vote
3
down vote
JavaScript (ES7), 133 bytes
Edit: Fixed to match the results returned by Jonathan Allan's code, which was given as a reference implementation by the OP.
n=>[...Array(m=k=7**n)].reduce(s=>s+/^1*5?40,33?20,36?00,3$/.test((--k+m).toString(7).replace(/0[62]|2[34]|4[51]/g,s=>s[1])),0)
Try it online!
How?
1) We generate all numbers of $N$ digits in base 7 with an extra leading $1$:
[...Array(m = k = 7 ** n)].reduce(s => ⦠(--k + m).toString(7) â¦, 0)
From now on, each digit will be interpreted as a Roman numeral symbol:
$$beginarray0longleftrightarrow textI, & 1longleftrightarrow textM, & 2longleftrightarrow textX, & 3longleftrightarrow textL,\
4longleftrightarrow textC, & 5longleftrightarrow textD, & 6longleftrightarrow textV
endarray$$
2) We replace all valid subtractive pairs of the form AB
with B
:
.replace(/0[62]|2[34]|4[51]/g, s => s[1])) // in the code
.replace(/I[VX]|X[LC]|C[DM]/g, s => s[1])) // with Roman symbols
Examples:
XLIXIV
becomesLXV
XIIV
becomesXIV
, leaving aI
that will make the next test failIC
remains unchanged, which also leaves an invalidI
in place
3) We check that the remaining symbols are in the correct order and do not appear more times than they're allowed to:
/^1*5?40,33?20,36?00,3$/.test(â¦) // in the code
/^M*D?C0,3L?X0,3V?I0,3$/.test(â¦) // with Roman symbols
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
add a comment |Â
up vote
3
down vote
JavaScript (ES7), 133 bytes
Edit: Fixed to match the results returned by Jonathan Allan's code, which was given as a reference implementation by the OP.
n=>[...Array(m=k=7**n)].reduce(s=>s+/^1*5?40,33?20,36?00,3$/.test((--k+m).toString(7).replace(/0[62]|2[34]|4[51]/g,s=>s[1])),0)
Try it online!
How?
1) We generate all numbers of $N$ digits in base 7 with an extra leading $1$:
[...Array(m = k = 7 ** n)].reduce(s => ⦠(--k + m).toString(7) â¦, 0)
From now on, each digit will be interpreted as a Roman numeral symbol:
$$beginarray0longleftrightarrow textI, & 1longleftrightarrow textM, & 2longleftrightarrow textX, & 3longleftrightarrow textL,\
4longleftrightarrow textC, & 5longleftrightarrow textD, & 6longleftrightarrow textV
endarray$$
2) We replace all valid subtractive pairs of the form AB
with B
:
.replace(/0[62]|2[34]|4[51]/g, s => s[1])) // in the code
.replace(/I[VX]|X[LC]|C[DM]/g, s => s[1])) // with Roman symbols
Examples:
XLIXIV
becomesLXV
XIIV
becomesXIV
, leaving aI
that will make the next test failIC
remains unchanged, which also leaves an invalidI
in place
3) We check that the remaining symbols are in the correct order and do not appear more times than they're allowed to:
/^1*5?40,33?20,36?00,3$/.test(â¦) // in the code
/^M*D?C0,3L?X0,3V?I0,3$/.test(â¦) // with Roman symbols
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
add a comment |Â
up vote
3
down vote
up vote
3
down vote
JavaScript (ES7), 133 bytes
Edit: Fixed to match the results returned by Jonathan Allan's code, which was given as a reference implementation by the OP.
n=>[...Array(m=k=7**n)].reduce(s=>s+/^1*5?40,33?20,36?00,3$/.test((--k+m).toString(7).replace(/0[62]|2[34]|4[51]/g,s=>s[1])),0)
Try it online!
How?
1) We generate all numbers of $N$ digits in base 7 with an extra leading $1$:
[...Array(m = k = 7 ** n)].reduce(s => ⦠(--k + m).toString(7) â¦, 0)
From now on, each digit will be interpreted as a Roman numeral symbol:
$$beginarray0longleftrightarrow textI, & 1longleftrightarrow textM, & 2longleftrightarrow textX, & 3longleftrightarrow textL,\
4longleftrightarrow textC, & 5longleftrightarrow textD, & 6longleftrightarrow textV
endarray$$
2) We replace all valid subtractive pairs of the form AB
with B
:
.replace(/0[62]|2[34]|4[51]/g, s => s[1])) // in the code
.replace(/I[VX]|X[LC]|C[DM]/g, s => s[1])) // with Roman symbols
Examples:
XLIXIV
becomesLXV
XIIV
becomesXIV
, leaving aI
that will make the next test failIC
remains unchanged, which also leaves an invalidI
in place
3) We check that the remaining symbols are in the correct order and do not appear more times than they're allowed to:
/^1*5?40,33?20,36?00,3$/.test(â¦) // in the code
/^M*D?C0,3L?X0,3V?I0,3$/.test(â¦) // with Roman symbols
JavaScript (ES7), 133 bytes
Edit: Fixed to match the results returned by Jonathan Allan's code, which was given as a reference implementation by the OP.
n=>[...Array(m=k=7**n)].reduce(s=>s+/^1*5?40,33?20,36?00,3$/.test((--k+m).toString(7).replace(/0[62]|2[34]|4[51]/g,s=>s[1])),0)
Try it online!
How?
1) We generate all numbers of $N$ digits in base 7 with an extra leading $1$:
[...Array(m = k = 7 ** n)].reduce(s => ⦠(--k + m).toString(7) â¦, 0)
From now on, each digit will be interpreted as a Roman numeral symbol:
$$beginarray0longleftrightarrow textI, & 1longleftrightarrow textM, & 2longleftrightarrow textX, & 3longleftrightarrow textL,\
4longleftrightarrow textC, & 5longleftrightarrow textD, & 6longleftrightarrow textV
endarray$$
2) We replace all valid subtractive pairs of the form AB
with B
:
.replace(/0[62]|2[34]|4[51]/g, s => s[1])) // in the code
.replace(/I[VX]|X[LC]|C[DM]/g, s => s[1])) // with Roman symbols
Examples:
XLIXIV
becomesLXV
XIIV
becomesXIV
, leaving aI
that will make the next test failIC
remains unchanged, which also leaves an invalidI
in place
3) We check that the remaining symbols are in the correct order and do not appear more times than they're allowed to:
/^1*5?40,33?20,36?00,3$/.test(â¦) // in the code
/^M*D?C0,3L?X0,3V?I0,3$/.test(â¦) // with Roman symbols
edited Aug 12 at 15:55
answered Aug 10 at 15:51
Arnauld
61.7k575258
61.7k575258
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
add a comment |Â
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
Holy cow, I didn't expect this one to be done in less than 200 bytes in non esoteric languages! Mind explaining how this works?
â Rushabh Mehta
Aug 10 at 15:53
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
However, I have noticed that this doesn't work for *n*>4 on TIO, which is somewhat unfortunate.
â Rushabh Mehta
Aug 10 at 15:57
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
@RushabhMehta I've added a non-recursive version to test higher values. I'll add an explanation when I'm done golfing this.
â Arnauld
Aug 10 at 16:07
add a comment |Â
up vote
0
down vote
C, 150 123 bytes
I didn't read the description closely enough, so this produces the number of standard Roman numerals (where expressions like IVI
aren't counted). Since I put some effort into it, I thought I would share anyway.
#define F(X) for(X=10;X--;)
x=0,1,2,3,2,1,2,3,4,2;f(i,o,a,b,c)for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];return o;
Original (150 bytes):
#define F(X) for(X=10;X--;)
i,o,a,b,c,x=0,1,2,3,2,1,2,3,4,2;main()scanf("%i",&i);for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];printf("%in",o);
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
I think you can remove the space betweenF(X)
andfor(X=10;X--;)
â Zacharý
Aug 12 at 17:10
add a comment |Â
up vote
0
down vote
C, 150 123 bytes
I didn't read the description closely enough, so this produces the number of standard Roman numerals (where expressions like IVI
aren't counted). Since I put some effort into it, I thought I would share anyway.
#define F(X) for(X=10;X--;)
x=0,1,2,3,2,1,2,3,4,2;f(i,o,a,b,c)for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];return o;
Original (150 bytes):
#define F(X) for(X=10;X--;)
i,o,a,b,c,x=0,1,2,3,2,1,2,3,4,2;main()scanf("%i",&i);for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];printf("%in",o);
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
I think you can remove the space betweenF(X)
andfor(X=10;X--;)
â Zacharý
Aug 12 at 17:10
add a comment |Â
up vote
0
down vote
up vote
0
down vote
C, 150 123 bytes
I didn't read the description closely enough, so this produces the number of standard Roman numerals (where expressions like IVI
aren't counted). Since I put some effort into it, I thought I would share anyway.
#define F(X) for(X=10;X--;)
x=0,1,2,3,2,1,2,3,4,2;f(i,o,a,b,c)for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];return o;
Original (150 bytes):
#define F(X) for(X=10;X--;)
i,o,a,b,c,x=0,1,2,3,2,1,2,3,4,2;main()scanf("%i",&i);for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];printf("%in",o);
C, 150 123 bytes
I didn't read the description closely enough, so this produces the number of standard Roman numerals (where expressions like IVI
aren't counted). Since I put some effort into it, I thought I would share anyway.
#define F(X) for(X=10;X--;)
x=0,1,2,3,2,1,2,3,4,2;f(i,o,a,b,c)for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];return o;
Original (150 bytes):
#define F(X) for(X=10;X--;)
i,o,a,b,c,x=0,1,2,3,2,1,2,3,4,2;main()scanf("%i",&i);for(i++;i--;)F(a)F(b)F(c)o+=i==x[a]+x[b]+x[c];printf("%in",o);
edited Aug 12 at 7:13
answered Aug 12 at 6:20
Curtis Bechtel
29618
29618
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
I think you can remove the space betweenF(X)
andfor(X=10;X--;)
â Zacharý
Aug 12 at 17:10
add a comment |Â
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
I think you can remove the space betweenF(X)
andfor(X=10;X--;)
â Zacharý
Aug 12 at 17:10
1
1
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
You're only allowed to post valid submissions.
â Okx
Aug 12 at 8:45
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
@CurtisBechtel You can keep the solution here I suppose, but I would try to modify it to satisfy the rules of the challenge.
â Rushabh Mehta
Aug 12 at 13:11
1
1
I think you can remove the space between
F(X)
and for(X=10;X--;)
â Zacharý
Aug 12 at 17:10
I think you can remove the space between
F(X)
and for(X=10;X--;)
â Zacharý
Aug 12 at 17:10
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f170437%2fwhen-in-rome-count-as-romans-do%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Comments are not for extended discussion; this conversation has been moved to chat.
â Megoâ¦
Aug 11 at 0:20