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

Home > Just Math
2+2=4 is true (Posted on 2014-06-22) Difficulty: 3 of 5
In what bases the cryptarithmetic puzzle TOO + TOO = FOR has a unique solution?

case A: each letter could be any digit, including 0.
case B: T could be any digit, except 0.
.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solutions Comment 2 of 2 |
For the first and second parts (above and below dashed line), each group shows the base, then the addition in that base, and then the decimal equivalents of the numbers shown:

 4
33+33=132
 15 15 30

 5
44+44=143
 24 24 48

------------
 6
155+155=354
 71 71 142

 7
166+166=365
 97 97 194

In the part-1 instances, T is the leading zero and doesn't show up in the printing.

DefDbl A-Z
Dim crlf$

Private Sub Form_Load()
 ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 For b = 2 To 50
   For showflag = 0 To 1
    Text2.Text = Str(b)
    DoEvents
    solct = 0
    ReDim used(b - 1)
    For t = 0 To b - 1
     used(t) = 1
    For o = 0 To b - 1
     If used(o) = 0 Then
        used(o) = 1
        too = b * b * t + o * (b + 1)
    For f = 0 To b - 1
     If used(f) = 0 Then
        used(f) = 1
    For r = 0 To b - 1
     If used(r) = 0 Then
        used(r) = 1
        forval = f * b * b + o * b + r
        
        If too + too = forval Then
         solct = solct + 1
         If showflag Then Text1.Text = Text1.Text & base$(too, b) & "+" & base$(too, b) & "=" & base$(forval, b) & crlf
         If showflag Then Text1.Text = Text1.Text & Str(too) & Str(too) & Str(forval) & crlf & crlf
        End If
        
        used(r) = 0
     End If
    Next
        used(f) = 0
     End If
    Next
        used(o) = 0
     End If
    Next
     used(t) = 0
    Next
    If solct = 1 And showflag = 0 Then
     Text1.Text = Text1.Text & Str(b) & crlf
     DoEvents
    Else
     Exit For  ' showflag
    End If
   Next showflag
 Next b

Text1.Text = Text1.Text & "------------" & crlf

 For b = 2 To 50
   For showflag = 0 To 1
    Text2.Text = Str(b)
    DoEvents
    solct = 0
    ReDim used(b - 1)
    For t = 1 To b - 1
     used(t) = 1
    For o = 0 To b - 1
     If used(o) = 0 Then
        used(o) = 1
        too = b * b * t + o * (b + 1)
    For f = 0 To b - 1
     If used(f) = 0 Then
        used(f) = 1
    For r = 0 To b - 1
     If used(r) = 0 Then
        used(r) = 1
        forval = f * b * b + o * b + r
        
        If too + too = forval Then
         solct = solct + 1
         If showflag Then Text1.Text = Text1.Text & base$(too, b) & "+" & base$(too, b) & "=" & base$(forval, b) & crlf
         If showflag Then Text1.Text = Text1.Text & Str(too) & Str(too) & Str(forval) & crlf & crlf
        End If
        
        used(r) = 0
     End If
    Next
        used(f) = 0
     End If
    Next
        used(o) = 0
     End If
    Next
     used(t) = 0
    Next
    If solct = 1 And showflag = 0 Then
     Text1.Text = Text1.Text & Str(b) & crlf
     DoEvents
    Else
     Exit For  ' showflag
    End If
   Next showflag
 Next b

End Sub
Function base$(n, b)
  v$ = ""
  n2 = n
  Do
    d = n2 Mod b
    n2 = n2 \ b
    v$ = LTrim(Str(d)) + v$
  Loop Until n2 = 0
  base$ = v$
End Function



  Posted by Charlie on 2014-06-22 13:07:40
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 (11)
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