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

Home > General > Cryptography
Ten cities (Posted on 2015-12-24) Difficulty: 3 of 5
1. 12345467546
2. 1231456
3. 1231233452
4. 12324545
5. 12 324
6. 123 45623
7. 123423
8. 123425
9. 123 4565
10. 1234567896

The coding above represents patterns of ten famous cities' names, where similar letters are represented by a certain digit, like Baku would be 1234 and Oslo 1231.
To minimize ambiguity, the order of the names is alphabetical.

Try to restore the official list.

See The Solution Submitted by Ady TZIDON    
Rating: 4.0000 (1 votes)

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

 1. 12345467546 
 2. 1231456 
 3. 1231233452 
 4. 12324545 
 5. 12 324                 La Paz
 6. 123 45623              Las Vegas
 7. 123423 
 8. 123425 
 9. 123 4565 
10. 1234567896

Then by computer, without regard to alphabetic order:

1 12345467546 albuquerque

2 1231456 chicago       *
2 1231456 gangtok
2 1231456 iquitos

3 1231233452 cincinnati
4 12324545 honolulu
5 12 324 la paz
6 123 45623 las vegas

7 123423 london          *
7 123423 handan

8 123425 bergen
8 123425 moscow          *
8 123425 leiden
8 123425 moscow
8 123425 boston
8 123425 denver
8 123425 dalian
8 123425 saipan          *
8 123425 palmas          *
8 123425 bhisho

9 123 4565 tel aviv
10 1234567896 washington

I've offset the sets that have ambiguity and marked with an asterisk the ones that fit alphabetically. Chicago and London are unambiguous in their alphabetic fit, but Moscow (the presumed official answer) could be replaced by either Saipan or Palmas.

The order within a given cypher is north to south on the globe, as the list of cities came from the Wikipedia article listing cities of the world by latitude (using comma-delimited file created by pasting into Excel, saving as .csv and renaming as .txt). It seems there are two Moscows included in their list (Russia and Idaho), but only one London (England only, not Ontario).

DefDbl A-Z
Dim crlf$, cypher$(10)


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
cypher$(1) = "12345467546"
cypher$(2) = "1231456"
cypher$(3) = "1231233452"
cypher$(4) = "12324545"
cypher$(5) = "12 324"
cypher$(6) = "123 45623"
cypher$(7) = "123423"
cypher$(8) = "123425"
cypher$(9) = "123 4565"
cypher$(10) = "1234567896"
 
For n = 1 To 10
 c$ = cypher$(n)
 ce$ = encode$(c)
 Open "world cities.txt" For Input As #1
 Do
   Line Input #1, l$
   If InStr(l, "?") > 0 Then
     ix1 = InStr(l, ",")
     ix2 = InStr(ix1 + 1, l, ",")
     ix3 = InStr(ix2 + 1, l, ",")
     city$ = LTrim(RTrim(LCase(Mid(l, ix2 + 1, ix3 - ix2 - 1))))
     If ce = encode$(city) Then
       Text1.Text = Text1.Text & n & " " & c & " " & city & crlf
     End If
   End If
 Loop Until EOF(1)
 Close 1
Next n
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Function encode$(w$)
   e$ = Space$(Len(w))
   nextup = 1
   For i = 1 To Len(w)
     ch$ = Mid(w, i, 1)
     If ch > " " Then
       ix = InStr(w, ch)
       If ix = i Then
         Mid$(e$, i, 1) = LTrim(Str(nextup))
         nextup = nextup + 1
       Else
          Mid$(e$, i, 1) = Mid$(e$, ix, 1)
       End If
     End If
   Next
   encode$ = e
End Function


  Posted by Charlie on 2015-12-24 10:48:08
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