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

 Code synonyms (Posted on 2013-03-14)
ROT13 is a code where every letter gets coded as the letter 13 letters from it in the alphabet.
```Letter:ABCDEFGHIJKLMNOPQRSTUVWXYZ
ROT13:NOPQRSTUVWXYZABCDEFGHIJKLM
```
There are two synonyms such that if you code either one of them with ROT13, then you will get the other. What are the two synonyms?

 See The Solution Submitted by Math Man No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer aided solution Comment 1 of 1

DECLARE FUNCTION isWord! (w\$)
OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "codesyn.txt" FOR OUTPUT AS #3
DO
LINE INPUT #1, w\$
IF w\$ = LCASE\$(w\$) THEN
w2\$ = ""
FOR i = 1 TO LEN(w\$)
v = ASC(MID\$(w\$, i, 1)) + 13
IF v > ASC("z") THEN v = v - 26
w2\$ = w2\$ + CHR\$(v)
NEXT
IF isWord(w2\$) THEN PRINT w\$, w2\$: PRINT #3, w\$, w2\$
END IF
LOOP UNTIL w\$ > "m"

FUNCTION isWord (w\$)
n = LEN(w\$)
w1\$ = SPACE\$(n)
OPEN "\words\words" + LTRIM\$(STR\$(n)) + ".txt" FOR BINARY AS #2
l = LOF(2) / n
low = 1: high = l
DO
mid = INT((low + high) / 2)
GET #2, (mid - 1) * n + 1, w1\$
IF w1\$ = w\$ THEN isWord = 1: CLOSE 2: EXIT FUNCTION
IF w1\$ < w\$ THEN low = mid + 1:  ELSE high = mid - 1
LOOP UNTIL low > high
isWord = 0
CLOSE 2
END FUNCTION

finds the following mutually coding words:

`a             nab            noabba          noonabjurer       nowhereabo           nobah            nuaha           nunan            naana           nananil          navyanna          naanant           nagar            neavo           nibba            onbalk          onyxbar           onebarf          onesbe            orbeen          orrabeg           ortben           orabin           ovabub           ohocel           prychat          pungchef          purscraal         pennycrag          pentcreel         perryebbs          roofeng           ratenvy          railer            reerg           reterne          rearerr           reeerrs          reefers           refflap          syncfrag          sentfrere         sererfry           selfun           shafur           shegel           tryghat          tunggnat          tanggreen         terragul           thyha            unhern          ureairk           vexjun           whajura          when`

It would seem IRK and VEX are the two sought.

But gnat and tang also have another symmetry as well, though not anything to do with this puzzle.

 Posted by Charlie on 2013-03-14 18:18:42

 Search: Search body:
Forums (0)