Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
3 deleted 28 characters in body
source | link

Mathematica, 186 164164 159 bytes

eMax@#-Min@#&[Fold[#//.{m___,x_,#2[[0]],y_,n___}:>{m,x~Last@#2~y,n}&,e,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"@Quotient,"%"@Mod}/. 0/0|1/0->Nothing]>{}]

\[Function] takes 3 bytes.

Some alternatives (keeps bytecount the same)

#2-#&@MinMax[...] to replace Max@#-Min@#&[...]

(##&[]) to replace Nothing

Head@#2 to replace #2[[0]]

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

Mathematica, 186 164 bytes

eMax@#-Min@#&[Fold[#//.{m___,x_,#2[[0]],y_,n___}:>{m,x~Last@#2~y,n}&,e,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"@Quotient,"%"@Mod}/. 0/0|1/0->Nothing]

\[Function] takes 3 bytes.

Some alternatives (keeps bytecount the same)

#2-#&@MinMax[...] to replace Max@#-Min@#&[...]

(##&[]) to replace Nothing

Head@#2 to replace #2[[0]]

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

Mathematica, 186 164 159 bytes

eMax@#-Min@#&[Fold[#//.{m___,x_,#2[[0]],y_,n___}:>{m,x~Last@#2~y,n}&,e,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"@Quotient,"%"@Mod}/. 0/0|1/0->{}]

\[Function] takes 3 bytes.

Some alternatives (keeps bytecount the same)

#2-#&@MinMax[...] to replace Max@#-Min@#&[...]

Head@#2 to replace #2[[0]]

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

2 added 74 characters in body
source | link

Mathematica, 186186 164 bytes

expr\[Function]#&@@Max@#eMax@#-First@Min@#&[Fold[#Min@#&[Fold[#//.{pre___m___,x_,#2[[0]],y_,post___n___}:>{prem,x~Last@#2~y,postn}&,expre,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"[\[LeftFloor]#/#2\[RightFloor]&]"@Quotient,"%"@Mod}/. 0/0|1/0->1/0]>Nothing]

\[LeftFloor]\[Function], takes 3 bytes.

Some alternatives (keeps bytecount the same)

\[RightFloor]#2-#&@MinMax[...] andto replace \[Function]Max@#-Min@#&[...] takes 3 bytes each.

Not golfed.(##&[]) to replace Nothing

Head@#2 to replace #2[[0]]

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

Mathematica, 186 bytes

expr\[Function]#&@@Max@#-First@Min@#&[Fold[#//.{pre___,x_,#2[[0]],y_,post___}:>{pre,x~Last@#2~y,post}&,expr,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"[\[LeftFloor]#/#2\[RightFloor]&],"%"@Mod}/. 0/0->1/0]

\[LeftFloor], \[RightFloor] and \[Function] takes 3 bytes each.

Not golfed.

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

Mathematica, 186 164 bytes

eMax@#-Min@#&[Fold[#//.{m___,x_,#2[[0]],y_,n___}:>{m,x~Last@#2~y,n}&,e,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"@Quotient,"%"@Mod}/. 0/0|1/0->Nothing]

\[Function] takes 3 bytes.

Some alternatives (keeps bytecount the same)

#2-#&@MinMax[...] to replace Max@#-Min@#&[...]

(##&[]) to replace Nothing

Head@#2 to replace #2[[0]]

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.

1
source | link

Mathematica, 186 bytes

expr\[Function]#&@@Max@#-First@Min@#&[Fold[#//.{pre___,x_,#2[[0]],y_,post___}:>{pre,x~Last@#2~y,post}&,expr,#]&/@Permutations@{"+"@Plus,"-"[#-#2&],"*"@Times,"/"[\[LeftFloor]#/#2\[RightFloor]&],"%"@Mod}/. 0/0->1/0]

\[LeftFloor], \[RightFloor] and \[Function] takes 3 bytes each.

Not golfed.

Try it online at http://sandbox.open.wolframcloud.com : enter ( .... )[{60, "/", 8, "%", 8, "*", 6, "%", 4, "*", 5}] with .... replaced by code above for test case 60 / 8 % 8 * 6 % 4 * 5. Press Shift + enter to evaluate.