Re: make 100 by using 1, 7, 7, 7, 7
- From: Thomas Nordhaus <thnord2002@xxxxxxxx>
- Date: Wed, 14 Nov 2007 13:52:32 +0100
Robert Israel schrieb:
Kira Yamato <kirakun@xxxxxxxxxxxxx> writes:
On 2007-11-13 13:22:13 -0500, Robert Israel <israel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> said:
"Benjamin A. Bartsch" <benjamin.a.bartsch@xxxxxxxxx> writes:I'm very curious how you concluded this. Was it by a program that tests through all possible combinations?
dangerousgam...@xxxxxxxxx schrieb:Yes, and that's the only solution (up to commutativity).So, using only +, -, x, /, and parentheses, and ONLY these numbers:--> (1/7+7)*(7+7)
1, 7, 7, 7, 7
how can you make 100? Is there more than one solution?
Benjamin
I tried to write a program too, but I stop when I couldn't quickly find a way to list out all possible trees with 7 leaves.
Here's my search program, written in Maple.
trees:= proc(S) option remember; local oper,SL,L,res,ret,V,W,v,w,R,r; if nops(S) = 1 then {[op(S),op(S)]}
else res:= {}; ret:= {};
for oper in [`+`,`-`,`/`,`*`] do
for SL in combinat[powerset]({$1..nops(S)}) do
if nops(SL) > 0 and nops(SL) < nops(S) then
L:= sort([seq(S[j],j=SL)]);
R:= sort([seq(S[j],j=({$1..nops(S)} minus SL))]);
V:= trees(L);
W:= trees(R);
for v in V do
for w in W do
if ((oper = `+`) or (oper = `*`)) and (v[1] > w[1]) then next end if; try
r:= oper(v[1],w[1]);
catch: next;
end try;
res:= res union {r};
ret:= ret union {[r, [v[2],oper,w[2]]]};
end do
end do
end if
end do
end do; ret
end if
end proc;
select(t -> (t[1]=100), T);
{[100, [[[1, /, 7], +, 7], *, [7, +, 7]]]}
Would the program be any simpler if you encoded RPN, that is +,-,/,E(nter)? The solution then is:
1E7/7+7E7+*
--
Thomas Nordhaus
.
- Follow-Ups:
- Re: make 100 by using 1, 7, 7, 7, 7
- From: Michael Press
- Re: make 100 by using 1, 7, 7, 7, 7
- References:
- make 100 by using 1, 7, 7, 7, 7
- From: dangerousgame95
- Re: make 100 by using 1, 7, 7, 7, 7
- From: Benjamin A. Bartsch
- Re: make 100 by using 1, 7, 7, 7, 7
- From: Robert Israel
- Re: make 100 by using 1, 7, 7, 7, 7
- From: Kira Yamato
- Re: make 100 by using 1, 7, 7, 7, 7
- From: Robert Israel
- make 100 by using 1, 7, 7, 7, 7
- Prev by Date: interpolation of function
- Next by Date: Re: Directional derivative in l^1 space
- Previous by thread: Re: make 100 by using 1, 7, 7, 7, 7
- Next by thread: Re: make 100 by using 1, 7, 7, 7, 7
- Index(es):
Relevant Pages
|