Google Answers Logo
View Question
 
Q: A wee Multiplication question ( No Answer,   8 Comments )
Question  
Subject: A wee Multiplication question
Category: Science > Math
Asked by: dprk007-ga
List Price: $25.00
Posted: 06 Mar 2005 17:54 PST
Expires: 05 Apr 2005 18:54 PDT
Question ID: 485881
ABC
                 DEF
                 ---
                 GHI
                JKL
               MNO
               -----
               PQRST    
  THe above represents the multiplication of the two numbers ABC and DEF.
  THe 20 letters (A to T) represent each digit 0 to 9 exactly twice. 
  I believe the answer is unique.
  Can you tell me the answer and how you got there?
  Regards
  
  DPRK007

Clarification of Question by dprk007-ga on 06 Mar 2005 17:58 PST
OOPS the letters got shifted in my first attempt Hope this is more clear!

                 ABC
                 DEF
                 ---
                 GHI
                JKL
               MNO
               -----
               PQRST    
  THe above represents the multiplication of the two numbers ABC and DEF.
  THe 20 letters (A to T) represent each digit 0 to 9 exactly twice. 
  I believe the answer is unique.
  Can you tell me the answer and how you got there?
  Regards
  
  DPRK007
Answer  
There is no answer at this time.

Comments  
Subject: Re: A wee Multiplication question
From: eliteskillsdotcom-ga on 06 Mar 2005 18:08 PST
 
Just to make it clear... it's

ABC * DEF = GHI
GHI * JKL * MNO = PQRST

??
Subject: Re: A wee Multiplication question
From: willcodeforfood-ga on 06 Mar 2005 23:27 PST
 
I believe this is the answer you are looking for:

     179
     224
     ---
     716
    358
   358
   -----
   40096

Answer obtained by brute force using VB6:

Private Sub Command1_Click()
    Dim i, j, ones, tens, hund, prod As Long
    For i = 0 To 999
        For j = 1 To 999
            op1 = ThreeDigits(i)
            op2 = ThreeDigits(j)
            ones = i * CLng(Mid(op2, 3, 1))
            tens = i * CLng(Mid(op2, 2, 1))
            hund = i * CLng(Mid(op2, 1, 1))
            prod = i * j
            ltrs = op1 & op2 & ones & tens & hund & prod
            If IsSolution(ltrs) Then
                Debug.Print "solution: " & op1 & " " & op2
            End If
        Next
    Next
End Sub

Private Function ThreeDigits(ByVal n As Integer)
    ThreeDigits = CStr(n)
    While Len(ThreeDigits) < 3
        ThreeDigits = "0" + ThreeDigits
    Wend
End Function

Function IsSolution(ltrs)
    Dim a(9) As Integer
    Dim idx As Integer
    IsSolution = True
    For i = 0 To 9
        a(i) = 0
    Next
    For i = 1 To Len(ltrs)
        idx = CInt(Mid(ltrs, i, 1))
        a(idx) = a(idx) + 1
    Next
    For i = 0 To 9
        If a(i) <> 2 Then IsSolution = False
    Next
End Function
Subject: Re: A wee Multiplication question
From: dprk007-ga on 07 Mar 2005 09:03 PST
 
Dear Willcodeforfood

Thank you so much for evaluating the answer to my question.
I was a bit surprised at your methodology. I was looking at  
a more elegant answer using mere pencil and paper.
But not to worry for now.

However one of my immediate ambitions is to learn VB6
(possibly though in a .net environment)
your little program may be an excellant starting point for me.
So I have a further question. 
I have a bogstandard PC with XP. Is there anyway I can run your
compile/run your program without loading anything further
(of course I believe it runs fine. I just need some practice 
and the opportunity to muck around with the code a little bit)

All the best for now.

DPRK007

PS I hope career prospects for VB developers is not as bad as your alias
would suggest
Subject: Re: A wee Multiplication question
From: eliteskillsdotcom-ga on 07 Mar 2005 12:54 PST
 
I don't understand the sandwhiched numbers(between----) mean.

Could you explain?
Subject: Re: A wee Multiplication question
From: willcodeforfood-ga on 07 Mar 2005 14:28 PST
 
eliteskillsdotcom,

Imagine you are doing old-fashioned multiplication by hand with pencil
and paper.  It would actually look a little more like this when you
were done, except that there'd be little "carry" digits all over the
place:

     179
   x 224
     ---
     716         =   4 * 179
    3580         =  20 * 179
 + 35800         = 200 * 179
   -----
 = 40096         now, adding up the three preceeding numbers

The zeroes are usually inserted to ensure clarity during the final
adding phase so the columns align properly.  They are optional,
though, and left out within the context of this problem.
Subject: Re: A wee Multiplication question
From: willcodeforfood-ga on 07 Mar 2005 14:56 PST
 
dprk007,

You're welcome for the answer.  If you have Microsoft Office
Professional, it will include Access, which will run this code (as it
uses a language called VBA which is practically indistiguishable from
VB 6.0).  VB.NET is slightly different from VB and would require that
you find and install a copy of Visual Studio .NET, although you might
be able to get a copy of the latest beta version from Microsoft for
free.  A little adaptation would be necessary to port the code to
VB.NET, but not much, especially since the code is fairly small.  If
it's really important to you, I'll port the code to C# or VB.NET for
you.

The name willcodeforfood is just for fun.  There are more jobs these
days working with data and writing software, so things are brighter
than they were a couple years ago.  My specialty is Internet and
database applications, but VB is just one of those things that you
can't help but pick up along the way.  VB is also easier for a
layperson to read than a lot of other languages.

Good luck,
willcodeforfood
Subject: Re: A wee Multiplication question
From: willcodeforfood-ga on 07 Mar 2005 15:43 PST
 
After some inquiry of my own, I discovered that if you are looking for
general methods for solving these sorts of problems, do a search on
the term "cryptarithmetic."

Here is a good primer on how to solve them.

[ http://www.geocities.com/Athens/Agora/2160/primer.html ]
Subject: Re: A wee Multiplication question
From: dprk007-ga on 08 Mar 2005 16:05 PST
 
Willcodeforfood

Many thanks for your further updates to my comments. Currently I
appear not to have Access (I cannot see a relevant icon and when I go
into programs I do not see Access under microsoft utilities). I
believe I had installed Microsoft Professional. However as I live in
the UK we may get less here than elsewhere in the world.
 I will be installing VB6 with studio .net and so I will see if I can
port this to the .net framework. (Your offer to port it to C# is much 
appeciated. However I think you have done enough for my question
especially as you do get paid). Also I appreciate you helping
eliteskillsdotcom on his/her queries.
Perhaps I must be one of those remaining souls who occasionally tries
to do  my sums the really old fashioned way (i.e. pencil and paper)
and without recourse to a calculator. (GRIN!)
DPRK007

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy