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

Home > General > Word Problems
Code synonyms (Posted on 2013-03-14) Difficulty: 3 of 5
ROT13 is a code where every letter gets coded as the letter 13 letters from it in the alphabet.
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.)
Solution computer aided solution Comment 1 of 1


OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "codesyn.txt" FOR OUTPUT AS #3
  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)
   IF isWord(w2$) THEN PRINT w$, w2$: PRINT #3, w$, w2$
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
     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
finds the following mutually coding words:  

a             n
ab            no
abba          noon
abjurer       nowhere
abo           nob
ah            nu
aha           nun
an            na
ana           nan
anil          navy
anna          naan
ant           nag
ar            ne
avo           nib
ba            on
balk          onyx
bar           one
barf          ones
be            or
been          orra
beg           ort
ben           ora
bin           ova
bub           oho
cel           pry
chat          pung
chef          purs
craal         penny
crag          pent
creel         perry
ebbs          roof
eng           rat
envy          rail
er            re
erg           ret
erne          rear
err           ree
errs          reef
ers           ref
flap          sync
frag          sent
frere         serer
fry           sel
fun           sha
fur           she
gel           try
ghat          tung
gnat          tang
green         terra
gul           thy
ha            un
hern          urea
irk           vex
jun           wha
jura          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
Please log in:
Remember me:
Sign up! | Forgot password

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

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information