All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Si fueris Romae (Posted on 2010-02-12) Difficulty: 4 of 5
It is a tricky cryptarithm, but still solvable.

I've solved it, why don't you?

ROME-SUM=RUSE

See The Solution Submitted by Ady TZIDON    
Rating: 3.6000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: I know the trick (spoiler) -- computer solution added | Comment 2 of 5 |
(In reply to I know the trick (spoiler) by Steve Herman)

Each set below is listed in order of

ROME
SUM
RUSE

with the arabic decimal representation on the right:

DCVI           606
XLV            45
DLXI           561
DCVI           606
LXV            65
DXLI           541
MCVI           1106
XLV            45
MLXI           1061
MCVI           1106
LXV            65
MXLI           1041


DECLARE FUNCTION roman$ (n!)
CLS
FOR a = 10 TO 2000
FOR b = 10 TO a
 ar$ = roman$(a)
 br$ = roman$(b)
 cr$ = roman$(a - b)

 IF LEN(ar$) = 4 AND LEN(br$) = 3 AND LEN(cr$) = 4 THEN
   IF LEFT$(ar$, 1) = LEFT$(cr$, 1) THEN
    IF MID$(ar$, 3, 1) = RIGHT$(br$, 1) THEN
     IF RIGHT$(ar$, 1) = RIGHT$(cr$, 1) THEN
      IF MID$(br$, 2, 1) = MID$(cr$, 2, 1) THEN
       IF INSTR(MID$(ar$, 2), LEFT$(ar$, 1)) = 0 THEN
        good = 1
        FOR i = 1 TO 3
         FOR j = 1 TO 4
           IF j <> i THEN
             IF MID$(ar$, i, 1) = MID$(ar$, j, 1) THEN good = 0
             IF MID$(br$, i, 1) = MID$(br$, j, 1) THEN good = 0
             IF MID$(cr$, i, 1) = MID$(cr$, j, 1) THEN good = 0
           END IF
         NEXT
        NEXT
        IF good THEN
                   PRINT ar$, a
                   PRINT br$, b
                   PRINT cr$, a - b
                   PRINT
        END IF
       END IF
      END IF
     END IF
    END IF
   END IF
 END IF
NEXT
NEXT

FUNCTION roman$ (n)

q = n \ 1000: r = n MOD 1000
r$ = STRING$(q, "M")
n2 = r
q = n2 \ 100: r = n2 MOD 100
SELECT CASE q
   CASE 9: r$ = r$ + "CM"
   CASE 5 TO 8: r$ = r$ + "D" + STRING$(q - 5, "C")
   CASE 4: r$ = r$ + "CD"
   CASE 0 TO 3: r$ = r$ + STRING$(q, "C")
END SELECT
n2 = r
q = n2 \ 10: r = n2 MOD 10
SELECT CASE q
   CASE 9: r$ = r$ + "XC"
   CASE 5 TO 8: r$ = r$ + "L" + STRING$(q - 5, "X")
   CASE 4: r$ = r$ + "XL"
   CASE 0 TO 3: r$ = r$ + STRING$(q, "X")
END SELECT
n2 = r
q = n2
SELECT CASE q
   CASE 9: r$ = r$ + "IX"
   CASE 5 TO 8: r$ = r$ + "V" + STRING$(q - 5, "I")
   CASE 4: r$ = r$ + "IV"
   CASE 0 TO 3: r$ = r$ + STRING$(q, "I")
END SELECT

roman$ = r$

END FUNCTION

 


  Posted by Charlie on 2010-02-12 15:45:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information