## Mathcad for brainteaser

## Mathcad for brainteaser

(OP)

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

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

## RE: Mathcad for brainteaser

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.

## RE: Mathcad for brainteaser

David

## RE: Mathcad for brainteaser

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

## RE: Mathcad for brainteaser

David

## RE: Mathcad for brainteaser

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:

http://mit

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

Christian.

## RE: Mathcad for brainteaser

^{3}TTFN

## RE: Mathcad for brainteaser

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

## RE: Mathcad for brainteaser

I really need some training.

jackboot

## RE: Mathcad for brainteaser

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.

## RE: Mathcad for brainteaser

Remember...

"If you don't use your head,

your going to have to use your feet."

## RE: Mathcad for brainteaser

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.

## RE: Mathcad for brainteaser

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

jackboot

## RE: Mathcad for brainteaser

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...

"If you don't use your head,

your going to have to use your feet."

## RE: Mathcad for brainteaser

Remember...

"If you don't use your head,

your going to have to use your feet."

## RE: Mathcad for brainteaser

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...

"If you don't use your head,

your going to have to use your feet."