12
$\begingroup$

In the following expression, replace each ? with either a digit or an operator:

8?5+??5-9?+3

so that it can evaluate to:

57883

$\endgroup$
  • 7
    $\begingroup$ Which operators can be used? $\endgroup$ – xnor Mar 23 '15 at 4:06
  • 2
    $\begingroup$ May we insert brackets "(" and ")" at arbitrary places in the expression? $\endgroup$ – Gamow Mar 23 '15 at 10:10
  • 4
    $\begingroup$ Is 8!5 permissible as "eight factorial times five", or is it invalid? Is 5+--5 permissible as "five plus the negation of the negation of five" or is it invalid? Is 8.5 + 0.5 permissible, or is . not an operator? Is 005 a valid value, or are leading zeroes forbidden? Should the expression be evaluated left to right, or using PEMDAS rules, or something else? $\endgroup$ – Kevin Mar 23 '15 at 13:01
  • 2
    $\begingroup$ @squeamishossifrage Going for a "pure math" solution, I got 8^5+7!5-90+3=57881. So close. $\endgroup$ – KSmarts Mar 23 '15 at 16:52
  • 2
    $\begingroup$ I think this puzzle contains a mistake. It should be "+5" at the end. :) $\endgroup$ – KSmarts Mar 23 '15 at 17:07
13
$\begingroup$

I was thinking of "non-mathematical solution" that would have well-defined and accepted operators, and that telling which operators are acceptable, and one that came to my mind was that

evaluate here means "matches a regular expression", and the solution is for example 8*5+7[5-9]+3

$\endgroup$
  • $\begingroup$ You got it, great job! :) Also accepted would be 8?5+7[5-9]+3 $\endgroup$ – pacoverflow Mar 23 '15 at 18:34
  • $\begingroup$ But then the first ? would have not been replaced ;-) $\endgroup$ – Antti Haapala Mar 23 '15 at 18:48
  • 5
    $\begingroup$ The wording of this question is misleading. A regular expression does not evaluate to a matching value, it validates a value. $\endgroup$ – Ian MacDonald Mar 23 '15 at 18:54
  • 1
    $\begingroup$ Interesting puzzle, but those characters are metacharacters. $\endgroup$ – overloading Mar 23 '15 at 19:13
  • 2
    $\begingroup$ @pacoverflow: No, the regex does not evaluate to many values. It validates many values. A regex is not a statement that evaluates to anything; it is a unary operator that takes an argument and produces a boolean result. $\endgroup$ – Ian MacDonald Mar 23 '15 at 20:00
2
$\begingroup$

I define the + operator as an operation that takes two somethings and returns 57883. Then I can insert whatever I want for the placeholders. The final +3 will give my the result.

$\endgroup$
1
$\begingroup$

Since you didn't originally clarify in the question that the operator must be a previously-defined and well-accepted operator, nor that an operator necessarily equates to a single character, my solution is:

8?5+??5-9?+3
885+475-9r+3

Where I have defined the following operators:
+ operator: (xyz)+(abc) : concatenate with inner-digit addition providing digit result: xy(z+a)bc.
- operator: xyz-y : delete digit providing digit result: xz.
r+ operator: xyzr+a : reverse the digits and concatenate without addition providing digit result: zyxa.

This works out as:

885+475-9r+3
88975-9r+3
8875r+3

57883

$\endgroup$
  • 1
    $\begingroup$ interesting way of thinking, but the question contains only 1 space behind the 9, you've put a digit ànd an operator behind it $\endgroup$ – JBSregath Mar 23 '15 at 14:58
  • $\begingroup$ Oh geez. I copied it from the question wrong when I started working on it. :S Gimmie a second. I'm sure there's a small tweak to make this still work. $\endgroup$ – Ian MacDonald Mar 23 '15 at 15:01
  • $\begingroup$ I’m fine with - and r+ but if your + operator is acceptable, then mine is too :P $\endgroup$ – poke Mar 23 '15 at 15:38
  • 2
    $\begingroup$ @IanMacDonald Oh no, my comment wasn’t really directed at you ;) (But yeah, you’re right, but still… how does a mathematician catch a lion? He gets in a cage and defines it as outside ;P) $\endgroup$ – poke Mar 23 '15 at 17:06
  • 2
    $\begingroup$ @poke The mathematician recalls that he has seen a lion in captivity. He makes a claim that since someone has caught a lion, a solution exists QED. $\endgroup$ – blakeoft Mar 23 '15 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.