0

# puzzle

Tue 5 Jun, 2012 06:00 am
Suppose you are given (1) a natural number N; (2) a set of natural num-
bers S = {n1; n2; : : : }; (3) a set of arithmetic operators, say +; -;*; =
(with the usual meaning of addition, multiplication, substraction, di-
vision). Your job is to construct an arithmetic expression R built from
the given operators and using each of the numbers in S exactly once,
with R = N.
(a) Explain in general how you could solve that problem.
(b) Solve the speci c instance: N = 24, S = {1; 3; 4; 6}
• Topic Stats
• Top Replies
Type: Question • Score: 0 • Views: 648 • Replies: 1
No top replies

markr

1
Tue 5 Jun, 2012 01:42 pm
@mah1,
I've actually done this. You'll need parentheses in the arithmetic expression. You could generate every possible string that looks like n.n.n.n, where . is any operator, but for each of those you 'd have to generate all possible parenthetical groupings. Per a suggestion from someone in another forum, I generated all of the possible postfix representations and wrote a postfix evaluator.

A postfix solution to part b is:
6 1 3 4 / - /
0 Replies

### Related Topics

LOGIC DEDUCTIONS - Question by lisalesa29
LOGIC DEDUCTIONS - Question by lisalesa29
Direct proof of n^2 is even implies n is even - Question by lampiaodecapoeira
help :) - Question by Dena 134
statistic q - Question by bayan
Fisher effect in tax competition - Question by kacius