Here is my solution. I stuck to the very basics of what was asked.

Code:

'Date Created: 10-Jun-2012 02:14:16 PM
'Last Updated: 10-Jun-2012 02:47:19 PM
'Created By : spilon
'Updated By : spilon
'Puzzle 28 - Alphabet Math
'Write an xbasic script that will solve this puzzle. Display your answer in a message box on screen.
'In the following math problem substitute numeric digits for the letters.
'Find the three numbers that these words represent.
'You may assume that none of the numbers begin with a zero. However, the number assigned to
'a letter must be the same everywhere that letter appears.
'
'Code:
' SEND
' + MORE
' -------
' MONEY
'
'There are numerous valid solutions to this, but only one where MONEY = 10,652.
'What are the values of SEND and MORE that make MONEY = 10,652 ?
'Credit for this puzzle: EasyCalculations.com
'Given: M-O-N-E-Y = 1-0-6-5-2
dim nMONEY as n = 10652
'Given: only one possible solution for previous given (i.e., not asked to prove only one solution)
'Assuming: digits unique for each letter
'Thus: S-E-N-D = ?-5-6-?
dim nSEND as n
'Thus: M-O-R-E = 1-0-?-5
dim nMORE as n
'With unique values for each letter, R = 3, 4, 7, 8 or 9
'Thus: M-O-R-E = 1-0-3-5 or 1-0-4-5 or 1-0-7-5 or 1-0-8-5 or 1-0-9-5
'Challange: look for occurance when nMONEY - nMORE has pattern ?-5-6-?
for nMORE = 1035 to 1095 step 10
'skip these values, as not part of check
if .not. inlist(nMORE,1055,1065) then
if right(left(ut(str(nMONEY - nMORE)),3),2) = "56" then
'we found our match
ui_msg_box("Send More Money",chr(9) + "Send" + chr(9) + (nMONEY - nMORE) + crlf() + "+" + chr(9) + "More" + chr(9) + nMore + crlf() + "_____________________________" + chr(9) + crlf() + "=" + chr(9) + "Money" + chr(9) + nMONEY)
exit for
end if
end if
'if we are still here, go to next number
next nMORE

## Bookmarks