mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   When in Rome... (https://www.mersenneforum.org/showthread.php?t=14618)

science_man_88 2011-01-09 15:31

[CODE]v=vector(100);v[1]=1;v[2]=2;v[3]=3;v[4]=4;v[5]=1;v[6]=2;v[7]=3;v[8]=4;v[9]=5;v[10]=1;for(i=11,#v,if(49<i%100<60,v[i]=v[i-10]+1,v[i-10]-3))[/CODE] is the best I can do and yes i know the last 2 commands are reversed order but that's because that's the only way I get close to [url]http://oeis.org/A092196[/url] and non negative answers.

science_man_88 2011-01-09 16:24

[QUOTE=science_man_88;245284][CODE]v=vector(100);v[1]=1;v[2]=2;v[3]=3;v[4]=4;v[5]=1;v[6]=2;v[7]=3;v[8]=4;v[9]=5;v[10]=1;for(i=11,#v,if(49<i%100<60,v[i]=v[i-10]+1,v[i-10]-3))[/CODE] is the best I can do and yes i know the last 2 commands are reversed order but that's because that's the only way I get close to [url]http://oeis.org/A092196[/url] and non negative answers.[/QUOTE]

doh I'm doing the complicated way for "traditional" lol. all i need is a loop for every symbol and to find the index in v to place it I multiply things lol. I'll start work on that after that I'll try the "modern" variety.

science_man_88 2011-01-09 16:37

[CODE]v=vector(3999);for(M=0,3,for(D=0,1,for(C=0,4,for(L=0,1,for(X=0,4,for(V=0,1,for(i=0,4,if(M==0 && D==0&& C==0 && L==0 && X==0 && V==0 && i==0,,v[M*1000+D*500+C*100+L*50+X*10+V*5+i*1]=M+D+C+L+X+V+i))))))))[/CODE] heres the code to do the traditional vector with.

CRGreathouse 2011-01-09 16:45

[QUOTE=NBtarheel_33;245252]I've seen (M) and M-with-an-overbar for 10,000, but never (()).[/QUOTE]

(M) is a different way of writing what I wrote as (()); other ways include ((I)), ⅭⅭⅠↃↃ, and ↂ. That last one (if it shows up for you) is how the symbol was actually written.

X with an overbar as 10,000 was a Middle Ages innovation never used by the Romans. (The Romans did occasionally put an overbar on their numerals, but this just meant "this is a number and not a word".) In that same Middle Age system M with an overbar was a million.

[QUOTE=NBtarheel_33;245252]Actually, I don't think IIII would be allowed in the "traditional" rules. IIII as a construct seems to have come about from Louis XIV's desire to have more symmetric clock faces, well after the Romans.[/QUOTE]

The chronology:

0. Etruscan numerals: IIII for 4, ɅIIII for 9.
1. Traditional Roman numerals: IIII for 4, VIIII for 9.
2. Middle-Age Roman numerals: IV for 4, IX for 9.
3. Renaissance: IIII for 4 but only on clocks, IX for 9.

10metreh 2011-01-09 17:08

In the "medieval" Roman numerals that are well known to most of us:
1, 5, 11, 15, 20, 40, 51, 55, 60, 90, 102, 104, 106, 109, 111, 115, 120, 140, 151, 155, 160, 190, 201, 205, 210, 250, 300, 401, 405, 410, 450, 502, 504, 506, 509, 511, 515, 520, 540, 551, 555, 560, 590, 601, 605, 610, 650, 700, 901, 905, 910, 950, 1003, 1007, 1012, 1016, 1019, 1021, 1025, 1030, 1041, 1045, 1052, 1054, 1056, 1059, 1061, 1065, 1070, 1091, 1095, 1102, 1104, 1106, 1109, 1111, 1115, 1120, 1140, 1151, 1155, 1160, 1190, 1201, 1205, 1210, 1250, 1300, 1401, 1405, 1410, 1450, 1502, 1504, 1506, 1509, 1511, 1515, 1520, 1540, 1551, 1555, 1560, 1590, 1601, 1605, 1610, 1650, 1700, 1901, 1905, 1910, 1950, 2002, 2004, 2006, 2009, 2011...
have the same number of "digits" in Roman and base-10 numerals. That list should be complete to 2011, but I might have made a mistake somewhere.

science_man_88 2011-01-09 17:12

[CODE]RomanModern(x=3999)=v=vector(3999);for(M=0,3,for(D=0,1,for(C=0,4,for(L=0,1,for(X=0,4,for(V=0,1,for(i=0,4,if(M==0 && D==0 && C==0 && L==0 && X==0 && V==0 && i==0,,v[M*1000+D*500+C*100+L*50+X*10+V*5+i*1]=M+D+C+L+X+V+i))))))));for(i=1,#v,if(i%5>3,v[i]=v[i]-2,if(i%10>8,v[i]=v[i]-1,if(i%50>39,v[i]=v[i]-2,if(i%100>90,v[i]=v[i]-1,if(i%500>399,v[i]=v[i]-2))))))[/CODE]

I can't find what went wrong here I know my first that doesn't match [url]http://oeis.org/A006968[/url] is for i = 9

I have a rule to implement now I just can't get how my computer might take it lol, if you notice if you reduce all multiples of 10^(x-1) under 10^x to the number 1-10 you find all numbers under 2 4 6 and 9 have the same number of digits as each other.

davar55 2011-01-09 18:07

[QUOTE=science_man_88;245304][CODE]RomanModern(x=3999)=v=vector(3999);for(M=0,3,for(D=0,1,for(C=0,4,for(L=0,1,for(X=0,4,for(V=0,1,for(i=0,4,if(M==0 && D==0 && C==0 && L==0 && X==0 && V==0 && i==0,,v[M*1000+D*500+C*100+L*50+X*10+V*5+i*1]=M+D+C+L+X+V+i))))))));for(i=1,#v,if(i%5>3,v[i]=v[i]-2,if(i%10>8,v[i]=v[i]-1,if(i%50>39,v[i]=v[i]-2,if(i%100>90,v[i]=v[i]-1,if(i%500>399,v[i]=v[i]-2))))))[/CODE]I can't find what went wrong here I know my first that doesn't match [URL]http://oeis.org/A006968[/URL] is for i = 9

I have a rule to implement now I just can't get how my computer might take it lol, if you notice if you reduce all multiples of 10^(x-1) under 10^x to the number 1-10 you find all numbers under 2 4 6 and 9 have the same number of digits as each other.[/QUOTE]

Why should i get to 9? It should only go to 4.

Efficiency is wasted in trying to improve your one liner.
Keep it simple and clear. (I think ... )

science_man_88 2011-01-09 18:19

[QUOTE=davar55;245314]Why should i get to 9? It should only go to 4.

Efficiency is wasted in trying to improve your one liner.
Keep it simple and clear. (I think ... )[/QUOTE]

sorry I'm thinking index not i doh lol.

CRGreathouse 2011-01-10 00:48

sm, see [url=http://rosettacode.org/wiki/Roman_numerals#PARI.2FGP]Roman numerals on RC[/url] where I wrote up quick solutions for old-style and medieval Roman numerals. Note that the output is printed rather than output (bad!) and that large numbers aren't supported in the modern/medieval function since I had no way of writing overlines.

Also note that there are many more styles than just the two I suggest here. For example, I'm fairly sure I recall a column (I thought it was Trajan's, but it looks like that's not right) that had "MMMMMMMMMMMMM" for 13,000. Perhaps this was just for effect, though.

science_man_88 2011-01-10 00:59

[QUOTE=CRGreathouse;245383]sm, see [url=http://rosettacode.org/wiki/Roman_numerals#PARI.2FGP]Roman numerals on RC[/url] where I wrote up quick solutions for old-style and medieval Roman numerals. Note that the output is printed rather than output (bad!) and that large numbers aren't supported in the modern/medieval function since I had no way of writing overlines.

Also note that there are many more styles than just the two I suggest here. For example, I'm fairly sure I recall a column (I thought it was Trajan's, but it looks like that's not right) that had "MMMMMMMMMMMMM" for 13,000. Perhaps this was just for effect, though.[/QUOTE]

I thought about a type like that myself without knowing it existed:

as for the RC function:

[code]()->v=vector(3999);for(M=0,3,for(D=0,1,for(C=0,4,for(L=0,1,for(X=0,4,for(V=0,1,for(i=0,4,if(M==0&&D==0&&C==0&&L==0&&X==0&&V==0&&i==0,,v[M*1000+D*500+C*100+L*50+X*10+V*5+i*1]=M+D+C+L+X+V+i))))))));return(v)
(n)->while(n>999999,n-=1000000;print1("((((I))))"));if(n>499999,n-=500000;print1("I))))"));while(n>99999,n-=100000;print1("(((I)))"));if(n>49999,n-=50000;print1("I)))"));while(n>9999,n-=10000;print1("((I))"));if(n>4999,n-=5000;print1("I))"));while(n>999,n-=1000;print1("(I)"));if(n>499,n-=500;print1("I)"));while(n>99,n-=100;print1("C"));if(n>49,n-=50;print1("L"););while(n>9,n-=10;print1("X"));if(n>4,n-=5;print1("V"););while(n,n--;print1("I"));print()[/code]

I'll admit it can go farther than mine care if i extend mine and see how they compare in length ?

as for the medieval one could you not use variables like BV for a bar over v ?

I see what you mean though.

science_man_88 2011-01-10 02:02

[QUOTE=10metreh;245303]In the "medieval" Roman numerals that are well known to most of us:
1, 5, 11, 15, 20, [COLOR="Red"]40[/COLOR], 51, 55, 60, [COLOR="red"]90[/COLOR], 102, [COLOR="red"]104[/COLOR], 106, [COLOR="red"]109[/COLOR], 111, 115, 120, [COLOR="red"]140[/COLOR], 151, 155, 160, [COLOR="red"]190[/COLOR], 201, 205, 210, 250, 300, [COLOR="red"]401, 405, 410, 450[/COLOR], 502, [COLOR="red"]504[/COLOR], 506, [COLOR="red"]509,[/COLOR] 511, 515, 520, [COLOR="Red"]540[/COLOR], 551, 555, 560, [COLOR="red"]590[/COLOR], 601, 605, 610, 650, 700, [COLOR="red"]901, 905, 910, 950,[/COLOR] 1003, 1007, 1012, 1016, [COLOR="red"]1019[/COLOR], 1021, 1025, 1030, [COLOR="red"]1041, 1045[/COLOR], 1052, [COLOR="Red"]1054[/COLOR], 1056, [COLOR="red"]1059[/COLOR], 1061, 1065, 1070, [COLOR="red"]1091, 1095[/COLOR], 1102, [COLOR="red"]1104[/COLOR], 1106, [COLOR="red"]1109[/COLOR], 1111, 1115, 1120,[COLOR="red"] 1140[/COLOR], 1151, 1155, 1160, [COLOR="red"]1190[/COLOR], 1201, 1205, 1210, 1250, 1300, [COLOR="Red"]1401, 1405, 1410, 1450[/COLOR], 1502, [COLOR="red"]1504[/COLOR], 1506, [COLOR="red"]1509[/COLOR], 1511, 1515, 1520, [COLOR="red"]1540[/COLOR], 1551, 1555, 1560, [COLOR="red"]1590[/COLOR], 1601, 1605, 1610, 1650, 1700, [COLOR="red"]1901, 1905, 1910, 1950[/COLOR], 2002, [COLOR="red"]2004[/COLOR], 2006, [COLOR="red"]2009[/COLOR], 2011...
have the same number of "digits" in Roman and base-10 numerals. That list should be complete to 2011, but I might have made a mistake somewhere.[/QUOTE]

well according to my old roman script here's the matching set for old roman:

[CODE]1,5,11,15,20,51,55,60,102,106,111,115,120,151,155,160,201,205,210,250,300,502,506,511,515,520,551,555,560,601,605,610,650,700,1003,1007,1012,1016,1021,1025,1030,1052,1056,1061,1065,1070,1102,1106,1111,1115,1120,1151,1155,1160,1201,1205,1210,1250,1300,1502,1506,1511,1515,1520,1551,1555,1560,1601,1605,1610,1650,1700,2002,2006,2011,2015,2020,2051,2055,2060,2101,2105,2110,2150,2200,2501,2505,2510,2550,2600,3001,3005,3010,3050,3100,3500,[/CODE]

I've highlighted what in your list doesn't match in mine so can't be tested with similarities.


All times are UTC. The time now is 04:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.