Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mathcad for brainteaser

Status
Not open for further replies.

jackboot

Mechanical
Jun 27, 2001
151
Can Mathcad be set up to do the following:

Given:

1, 3, 4, and 6

use these four numbers using any of the standard math functions (+,-,/,*) and determine the expression that will equal 24.

jackboot
 
Replies continue below

Recommended for you

Not easily.

You'd be better off writing a program in a language that supports EVAL or equivalent, that creates equations with valid syntax and then works out the result.

You'd also have to be very careful about defining your precedence rules, if brackets are not permitted.



Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
If brackets are not permitted, then it can't be solved.

David
 
RPN?

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
My kid showed me a solution without brackets or RPN. I keep forgetting that we should hire teenagers while they still know everything.

David
 
Hello,

are you sure, it works? I wrote it in MathCAD and didn't find a solution. It wasn't "easy" (@GregLocock) but it works. There are 1536 posibilities, no one is doubled and there is no equation with the result 24 (if my program works right).

You find the program as PDF at my website:


I havn't time enough to check the whole code for mistakes, even I can't endure that a teenager get the solution.

Christian.
 
The only way I know that works is 4*6/13

TTFN
 


This is the address to the math teaser.

It says:
24 - Arithmetic - Hard
Using each of the numbers 1,3,4,6 create an expression which evaluates to 24. You may use any of the four standard arithmetic operations *,+,-,/ and parenthesis. You must use each of the numbers exactly once. You need not use any other numbers. It can also be done with 3,3,8,8.

It is supposed to have a solution unless it is just a joke.

jackboot
 
Christian - that is a real cool Mathcad sheet.

I really need some training.

jackboot
 
Christian - I agree with jackboot. my eyes glazed over.

Jackboot, if you can understand Christians' sheet then use that.

Otherwise I'd define a syntax, that all parentheses must be used. Then I'd write all the legal patterns, where i is an integer and o is an operator

((ioi)o(ioi))
(io(io(ioi)))
(((ioi)oi)oi)
((io(ioi))oi)
(io((ioi)oi))

is that all there are?

make the appropriate substitutions and you should get there.

I make the total number of combinations 5*(4*3*2*1)*4*4*4=
7680, of which many are no doubt dupes, since + and * are commutative.





Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
HOW ABOUT 6/(1-(3/4)) = 24

Remember...
[navy]"If you don't use your head,[/navy] [idea]
[navy]your going to have to use your feet."[/navy]
 
@meintsi:

You forgot that the original question was WITHOUT brackets (zdas04 from Apr 7). Based on that statement I wrote the program. But I've actual no time to change it working with brackets.

Christian.
 
Christain - sorry about the mistake. I put the actual web link on this post as soon as I saw it.

meintsi - you win the cigar. How did you come up with the solution?

jackboot
 
Where does this say that brackets are not permitted?

And if you read the author's second post from 11 Apr 05 11:56}, I repeat...

"This is the address to the math teaser.

It says:
24 - Arithmetic - Hard
Using each of the numbers 1,3,4,6 create an expression which evaluates to 24. You may use any of the four standard arithmetic operations *,+,-,/ and parenthesis. You must use each of the numbers exactly once. You need not use any other numbers. It can also be done with 3,3,8,8.

It is supposed to have a solution unless it is just a joke."

Remember...
[navy]"If you don't use your head,[/navy] [idea]
[navy]your going to have to use your feet."[/navy]
 
Similarly, the second answer would be 8/(3-(8/3))=24

Remember...
[navy]"If you don't use your head,[/navy] [idea]
[navy]your going to have to use your feet."[/navy]
 
This is a very old and often asked problem.

Solutions sets also include
1237 1334 1467 1555 1569 1668
2258 2469 4778 5668 5788



But the hardest one is to solve is....

Obtain an expression which equals 24.

Using the numbers 4 7 7 9
Using + - x / .




Remember...
[navy]"If you don't use your head,[/navy] [idea]
[navy]your going to have to use your feet."[/navy]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor