Apply any mathematical function

  • Thread starter Thread starter Sune Fibaek
  • Start date Start date
S

Sune Fibaek

Hi

I have a bit of a tricky question.

Three identical integers (ex. 3, 3, 3). Apply any mathematical funtion to
each to make the sum=6. In the case of 3: 3*3-3=6 or -3+3*3. The integers are
from 1 through 9. Always in identical triplets.

Obviously this is one of those annoying viral emails. I thought I might give
it a shot with Excel rather than to just brute force it. Got stuck though.

Any thoughts?

/Sune
 
When I first came across this type of problem (about 20 years ago) it
was to use 4 identical digits (eg nines) to produce all the numbers
from 1 to 20 using any of the four main arithmetic operations (i.e.
not exponentiation, factorials etc). Brackets were allowed, though.
The solutions called for a bit of lateral thinking, and I'm not sure
if Excel is up to that.

Pete
 
Pete_UK said:
When I first came across this type of problem (about 20 years ago) it

I'll admit it is not exactly new...
The solutions called for a bit of lateral thinking, and I'm not sure
if Excel is up to that.

I came to that conclusion as well. Especially given that apparently this is
an acceptable solution (according to the sender):

2^4-2^3-2=6

Whereas this:

2^2+2=6

Is not. That leaves me with litteraly an infinite number of possible
solutions. But also makes it quite easy given that then this is also possible:

=SUM((8-LOG(100));(8*LOG(1));(8*LOG(1))).

I figure that if ^4 is a mathematical function (as opposed to power being
the funtion and 4 being the value of the funtion) then log(100) is a funtion
as well.

And thus ends yet another unproductive ½ hour at work :)

/Sune
 
Well, I'm not sure how you (or the sender) can justify:

2^4-2^3-2=6

if you are meant to be using only three 2s, especially as:

2 + 2 + 2 = 6

2^4 is just shorthand for 2 * 2 * 2 * 2, so how can that be allowed?

Pete
 
Sune,

Sub Find6()
Dim Op1 As Variant
Dim Op2 As Variant
Dim Op3 As Variant
Dim myStr As String
Dim Result As Double
Dim AllOp As Variant
Dim i As Integer
Dim j As Integer
Dim k As Integer

AllOp = Array("+", "-", "*", "/", "^")

On Error GoTo NoGood
For i = 1 To 9
For Each Op1 In AllOp
For Each Op2 In AllOp
For Each Op3 In AllOp
myStr = Op1 & i & Op2 & i & Op3 & i
Result = Evaluate(myStr)
If Result = 6 And Result = Int(Result) Then
MsgBox myStr & " = 6"
GoTo Found6 'Comment out this line to see all solutions
End If
KeepGoing:
Next Op3
Next Op2
Next Op1
Found6:
Next i

Exit Sub
NoGood:
Resume KeepGoing

End Sub
 
Bob,

Why do you think it seems that way? Did you try the code? I certainly did.... and I did not get
stuck.

HTH,
Bernie
MS Excel MVP
 
The code doesn't stop kind of stuck , there just isn't a solution for 1
kind of stuck.
 
You really need a computer to solve the puzzle???
Do it yourself!
Here is the solution for 1:

(1+1+1)!

where ! means the function 'fact'.
 
Back
Top