Thursday, January 28, 2010

Chris, Zaux, Wiz = Arias

Chris + Zaux + Wiz = Arias

Each letter in the sum above represents a different digit.

Can you crack the code?

There's one solution to this one.

Labels:

20 Comments:

Blogger g.blystone said...

23484+1209+131=24824

January 28, 2010 6:22 PM  
Blogger Chris said...

Miles out. You've got e.g.
Z = W, C = A, I = 8 and 3

January 28, 2010 6:29 PM  
Anonymous Taylor said...

12536+23512+423+36471

January 29, 2010 3:48 AM  
Blogger Ragknot said...

Taylor,

Chris + Zaux + Wiz = Arias

Are you guessing?
The first word and the last word both end with the same letter.

The second word must be 4 digits long. You don't have an equal sign.

It can't be right.

January 29, 2010 5:16 AM  
Anonymous Anonymous said...

C H R I S
4 8 6 2 9

Z A U X
7 5 0 3

W I Z
1 2 7

A R I A S
5 6 2 5 9

Key:
A C H I R S U W X Z
5 4 8 2 6 9 0 1 3 7

Method applied: Brute force

Cam

January 29, 2010 9:02 AM  
Blogger Ragknot said...

This post has been removed by the author.

January 29, 2010 10:03 AM  
Blogger Ragknot said...

Chris = 48629
Zaux = 7503
Wiz = 127
Arias = 56259

A great job.

I have figured that this is about a 1 in 3,628,800 shot. Of course your ability can make it a "sure shot".

But I still rate these as some of the most difficult puzzles.

January 29, 2010 10:06 AM  
Blogger Ragknot said...

Dim mys As String
Dim key As String

Sub bafflingNumbersMain()
'The variables in this sub should not change
'except for maybe A=1 to 9 might be A=0 to 9
'if A can be zero
Dim a, b, c, D, e, f, g, h, i, j As Integer
Dim s As String
Dim Zz As Long
Zz = 0
time1 = Timer
Debug.Print "Beginning Sheet Number:"; sheetno
'if A can't be zero, start at 1
1 For a = 1 To 9
s = a
Debug.Print
Debug.Print a;
2 For b = 0 To 9
s = Left(s, 1): If InStr(1, s, b) Then GoTo NXB
s = s & b
Debug.Print ".";
3 For c = 0 To 9
s = Left(s, 2): If InStr(1, s, c) Then GoTo NXC
s = s & c
4 For D = 0 To 9
s = Left(s, 3): If InStr(1, s, D) Then GoTo NXD
s = s & D
5 For e = 0 To 9
s = Left(s, 4): If InStr(1, s, e) Then GoTo NXE
s = s & e
6 For f = 0 To 9
s = Left(s, 5): If InStr(1, s, f) Then GoTo NXF
s = s & f
7 For g = 0 To 9
s = Left(s, 6): If InStr(1, s, g) Then GoTo NXG
s = s & g
8 For h = 0 To 9
s = Left(s, 7): If InStr(1, s, h) Then GoTo NXH
s = s & h
9 For i = 0 To 9
s = Left(s, 8): If InStr(1, s, i) Then GoTo NXI
s = s & i
10 j = 45 - a - b - c - D - e - f - g - h - i
s = s & j
mys = s
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Gotit = Test(a, b, c, D, e, f, g, h, i, j)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Zz = Zz + 1
If Gotit Then
time2 = Timer
Debug.Print "Done Sheet number "; sheetno; " Number of loops=:"; Zz; "Time= "; time2 - time1; " Seconds"
Debug.Print "-------------------------------"
End If
NXI: Next i
NXH: Next h
NXG: Next g
NXF: Next f
NXE: Next e
NXD: Next D
NXC: Next c
NXB: Next b
NXA: Next a
time2 = Timer
Debug.Print
Debug.Print "Done Sheet number "; sheetno; " Number of loops=:"; Zz; "Time= "; time2 - time1; " Seconds"
Debug.Print "-------------------------------"
Debug.Print "---------Finished---------------"
End Sub

Function Test(c, h, r, i, s, z, a, u, x, w)
Test = False
'Check for 0 at beginning of each word
If c = "0" Then Exit Function
If z = "0" Then Exit Function
If w = "0" Then Exit Function
If a = "0" Then Exit Function
chris = Val(c & h & r & i & s)
Zaux = Val(z & a & u & x)
Wiz = Val(w & i & z)
arias = Val(a & r & i & a & s)
If chris + Zaux + Wiz = arias Then
Test = True
Debug.Print
Debug.Print "Key = ChrisZauxW"
Debug.Print "MyS = "; mys
Debug.Print "Chris = "; chris
Debug.Print "Zaux = "; Zaux
Debug.Print "Wiz = "; Wiz
Debug.Print "Arias = "; arias
End If
End Function

January 29, 2010 10:59 AM  
Blogger Ragknot said...

Cam,

Talk about Brute Force,

The above VBA will find solutions that solve any of these problems in less than a minute.

It found the solution to this one in 11 seconds on my PC. The main sub generates possible solutions and the test actually finds the solution.

I would like to see your brute force routines.

January 29, 2010 2:15 PM  
Anonymous Anonymous said...

Ragknot, this is just VB in Excel routine. It's pretty sloppy and inefficient, but it still finds all solutions in < 1 min, so speed of programming took precedent over decent coding.

Sub findsoltrickofmind()
Set ws = Sheets("Sheet1")
Dim a10(10) As Integer
Dim a9(9) As Integer
Dim a8(8) As Integer
Dim a7(7) As Integer
Dim a6(6) As Integer
Dim a5(5) As Integer
Dim a4(4) As Integer
Dim a3(3) As Integer
Dim a2(2) As Integer
Dim a1(1) As Integer
Dim b(10) As Integer
For i = 1 To 10
a10(i) = i - 1
Next

ycounter = 0
xcounter = 0

For j1 = 1 To 10
For j2 = 1 To 9
For j3 = 1 To 8
For j4 = 1 To 7
For j5 = 1 To 6
For j6 = 1 To 5
For j7 = 1 To 4
For j8 = 1 To 3
For j9 = 1 To 2
For j10 = 1 To 1

b(1) = a10(j1)

m = 0
For k = 1 To 9
If k < j1 Then
m = m + 1
a9(m) = a10(k)
End If
If k >= j1 Then
m = m + 1
a9(m) = a10(k + 1)
End If
Next

b(2) = a9(j2)

m = 0
For k = 1 To 8
If k < j2 Then
m = m + 1
a8(m) = a9(k)
End If
If k >= j2 Then
m = m + 1
a8(m) = a9(k + 1)
End If
Next

b(3) = a8(j3)

m = 0
For k = 1 To 7
If k < j3 Then
m = m + 1
a7(m) = a8(k)
End If
If k >= j3 Then
m = m + 1
a7(m) = a8(k + 1)
End If
Next


b(4) = a7(j4)

m = 0
For k = 1 To 6
If k < j4 Then
m = m + 1
a6(m) = a7(k)
End If
If k >= j4 Then
m = m + 1
a6(m) = a7(k + 1)
End If
Next


b(5) = a6(j5)

m = 0
For k = 1 To 5
If k < j5 Then
m = m + 1
a5(m) = a6(k)
End If
If k >= j5 Then
m = m + 1
a5(m) = a6(k + 1)
End If
Next

b(6) = a5(j6)

m = 0
For k = 1 To 4
If k < j6 Then
m = m + 1
a4(m) = a5(k)
End If
If k >= j6 Then
m = m + 1
a4(m) = a5(k + 1)
End If
Next

b(7) = a4(j7)

m = 0
For k = 1 To 3
If k < j7 Then
m = m + 1
a3(m) = a4(k)
End If
If k >= j7 Then
m = m + 1
a3(m) = a4(k + 1)
End If
Next

b(8) = a3(j8)

m = 0
For k = 1 To 2
If k < j8 Then
m = m + 1
a2(m) = a3(k)
End If
If k >= j8 Then
m = m + 1
a2(m) = a3(k + 1)
End If
Next

b(9) = a2(j9)

m = 0
For k = 1 To 1
If k < j9 Then
m = m + 1
a1(m) = a2(k)
End If
If k >= j9 Then
m = m + 1
a1(m) = a2(k + 1)
End If
Next

b(10) = a1(j10)



'evaluate using key of CDFIKMNORT
answer = 0


firstword = b(10) * 10 ^ 4 + b(9) * 10 ^ 3 + b(4) * 10 ^ 2 + b(1) * 10 + b(5)
secondword = b(8) * 10 + b(3)
thirdword = b(6) * 10 ^ 3 + b(4) * 10 ^ 2 + b(7) * 10 + b(2)
lastword = b(10) * 10 ^ 4 + b(8) * 10 ^ 3 + b(7) * 10 ^ 2 + b(4) * 10 + b(1)

'check sum
If (firstword + secondword - thirdword) = lastword Then
'check if first letter is 0... last b(10) is redundant
If (b(10) <> 0) And (b(8) <> 0) And (b(6) <> 0) And (b(10) <> 0) Then
answer = 1
End If
End If

'display answer

If answer = 1 Then
ycounter = ycounter + 1

For g = 1 To 10
ws.Cells(5 + ycounter, 12 + g - 1).Value = b(g)
Next
End If

'display iteration... to avoid watched kettle syndrome
xcounter = xcounter + 1

If (xcounter - 10000 * Int(xcounter / 10000)) = 0 Then
ws.Cells(1, 25).Value = xcounter
End If




Next
Next
Next
Next
Next
Next
Next
Next
Next
Next

End Sub

January 29, 2010 6:17 PM  
Anonymous Anonymous said...

I should probably mention that the above code was for:
Trick + Of - Mind = TONIC

to change words and equations
the eqs for each word, the check sum, and the checks for which letters aren't 0 will obviously change

Cam

January 29, 2010 6:30 PM  
Blogger Ragknot said...

thanks, Cam

It will be interesting watching the logic. I am sure I will learn things from it.

January 29, 2010 7:11 PM  
Blogger Chris said...

Well you have both surprised me. I had imagined (without any examination) that the code would have run in a very short time). I never would have guessed anywhere near as long as a minute.

That's not a criticism, it's genuine surprise.

January 29, 2010 7:19 PM  
Blogger Chris said...

I suppose that 10!(approx 3.6 million) must be in there somewhere.

January 29, 2010 7:21 PM  
Blogger Ragknot said...

Well Cam,

First thing I note is that it verifies all 484 solutions to that

TRICK + OF - MIND = TONIC

Multiple solutions is very common when words are short. I suspected that the minus added many solutions, but I've never looked into it.

I can see the logic is obvious, but I am going to try.

January 29, 2010 7:37 PM  
Blogger Ragknot said...

3.6 million?

sure but that's for base 10.

I've thought about using base 16, or 48 just to expand the trick.

January 29, 2010 7:41 PM  
Anonymous Karl Sharman said...

c h r i s
4 8 6 2 9
z a u x
7 5 0 3
w i z
1 2 7
a r i a s
5 6 2 5 9

I took the old fashioned "brute force" approach, and mixed it with a bit of stubborn-ness.
But everyone has now answered...
Thanks for the VBA Ragknot.

January 30, 2010 4:24 AM  
Blogger Ragknot said...

Sub findsoltrickofmind()
Dim WS As Worksheet
Dim J1, J2, J3, J4, J5, J6, J7, J8, J9, J10, I, K, ROW, COLUMN As Integer
Dim TIMER1 As Double
Dim S As String
Dim a10(10) As Integer
Dim a9(9) As Integer
Dim a8(8) As Integer
Dim a7(7) As Integer
Dim a6(6) As Integer
Dim a5(5) As Integer
Dim a4(4) As Integer
Dim a3(3) As Integer
Dim a2(2) As Integer
Dim a1(1) As Integer
Dim b(10) As Integer
Dim hjg As Integer
Set WS = Sheets("Sheet1")
COLUMN = 1
TIMER1 = Timer
For I = 1 To 10
a10(I) = I - 1
Next
For J1 = 1 To 10
For J2 = 1 To 9
For J3 = 1 To 8
For J4 = 1 To 7
For J5 = 1 To 6
For J6 = 1 To 5
For J7 = 1 To 4
For J8 = 1 To 3
For J9 = 1 To 2
For J10 = 1 To 1
b(1) = a10(J1)
For K = 1 To 9
If K < J1 Then a9(K) = a10(K) Else a9(K) = a10(K + 1)
Next K
b(2) = a9(J2)
For K = 1 To 8
If K < J2 Then a8(K) = a9(K) Else a8(K) = a9(K + 1)
Next K
b(3) = a8(J3)
For K = 1 To 7
If K < J3 Then a7(K) = a8(K) Else a7(K) = a8(K + 1)
Next K
b(4) = a7(J4)
For K = 1 To 6
If K < J4 Then a6(K) = a7(K) Else a6(K) = a7(K + 1)
Next K
b(5) = a6(J5)
For K = 1 To 5
If K < J5 Then a5(K) = a6(K) Else a5(K) = a6(K + 1)
Next K
b(6) = a5(J6)
For K = 1 To 4
If K < J6 Then a4(K) = a5(K) Else a4(K) = a5(K + 1)
Next K
b(7) = a4(J7)
For K = 1 To 3
If K < J7 Then a3(K) = a4(K) Else a3(K) = a4(K + 1)
Next K
b(8) = a3(J8)
For K = 1 To 2
If K < J8 Then a2(K) = a3(K) Else a2(K) = a3(K + 1)
Next K
b(9) = a2(J9)
For K = 1 To 1
If K < J9 Then a1(K) = a2(K) Else a1(K) = a2(K + 1)
Next K
b(10) = a1(J10)
'S = "": ROW = ROW + 1
'For hjg = 1 To 10
' S = S & Trim(Str(b(hjg)))
'Next hjg
'WS.Cells(ROW, COLUMN).Value = S
'WS.Cells(ROW, COLUMN + 1).Value = S
'If ROW = 1048576 Then Stop
Next J10
Next J9
Next J8
Next J7
Next J6
Next J5
Next J4
Next J3
Next J2
Next J1

Debug.Print Timer - TIMER1
End Sub

January 30, 2010 4:26 PM  
Blogger Ragknot said...

this was supposed to above the previous post..........

Cam,
I still don't completely understand the logic, I am working with it and changing it to my way of thinking to help myself.

I did away with the M variable, because it seemed to always be the same as the K. I used an ELSE where you had two IF's

I am running it without a test, just to watch the engine run, and it seems to run about 30% faster.

It's pretty neat how you predict the next number. I was once trying to figure out the pattern but it took to much time.

January 30, 2010 4:27 PM  
Blogger Ragknot said...

Karl

Thanks for the kind words.

The first part, the Sub is just an engine that creates the 3.6 million unique 10 digit strings. Each of the strings is sent to a function that tests for a solution. So you could just adjust the test function for specific puzzles and let the engine call the specific test.

I've been working on a method of generating the problems, and I have learned building a problem takes much more time than solving them... mainly because I want words not just random letters.

January 30, 2010 6:10 PM  

Post a Comment

Links to this post:

Create a Link

<< Home