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

Home > Numbers
A classic game (Posted on 2005-06-22) Difficulty: 3 of 5
Substitute digits for letters (different letters, different digits; same letters, same digits) so ALPHABET + LETTERS = SCRABBLE. No number begins with zero.

Can you manage without a computer program?

See The Solution Submitted by e.g.    
Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: Charlie and Federico Kereki.... | Comment 8 of 9 |
(In reply to Charlie and Federico Kereki.... by Penny)

My original QuickBasic program ran in under 1 second to check for all possibilities, not just to get the first (and only) answer.

The following program runs in Visual Basic 5.0 and probably .net (which I don't have) also:

Dim taken(10)

Private Sub Command1_Click()
Print Time
For i = 1 To 10: taken(i) = 0: Next
a = 1: s = 2: t1 = 10001000 - 10000 + 2 - 20000000
taken(1) = 1: taken(2) = 1
For l = 0 To 9
 If taken(l) = 0 Then
  taken(l) = 1
  t2 = t1 + l * (2000000 - 10)
For p = 0 To 9
 If taken(p) = 0 Then
  taken(p) = 1
  t3 = t2 + p * 100000
For b = 0 To 9
 If taken(b) = 0 Then
  taken(b) = 1
  t4 = t3 + b * (100 - 1100)
For e = 0 To 9
 If taken(e) = 0 Then
  taken(e) = 1
  t5 = t4 + e * (100110 - 1)
For t = 0 To 9
 If taken(t) = 0 Then
  taken(t) = 1
  t6 = t5 + t * 11001
For r = 0 To 9
 If taken(r) = 0 Then
  taken(r) = 1
  t7 = t6 + r * (10 - 100000)
For c = 0 To 9
 If taken(c) = 0 Then
  taken(c) = 1
  t8 = t7 - c * 1000000
For h = 0 To 9
 If taken(h) = 0 Then
  taken(h) = 1
  t9 = t8 + h * 10000

  If t9 = 0 Then
   Print a; l; p; h; a; b; e; t
   Print l; e; t; t; e; r; s
   Print s; c; r; a; b; b; l; e
  End If

  taken(h) = 0
 End If
Next
  taken(c) = 0
 End If
Next
  taken(r) = 0
 End If
Next
  taken(t) = 0
 End If
Next
  taken(e) = 0
 End If
Next
  taken(b) = 0
 End If
Next
  taken(p) = 0
 End If
Next
  taken(l) = 0
 End If
Next
Print Time

End Sub

And, when I just pressed the Command1 button, I got:

9:33:06 AM
 1 7 5 3 1 9 0 8
 7 0 8 8 0 6 2
 2 4 6 1 9 9 7 0
9:33:06 AM

The times match, between which all possibilities were checked.

Added this:

A better value is obtained by using the Timer function rather than the Time function. It resulted in 34741.69 as the start number of seconds past midnight and 34742.04 as the finish, for a time of 0.35 seconds to check all possibilities.

Edited on June 23, 2005, 2:12 pm
  Posted by Charlie on 2005-06-23 14:07:20

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 (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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