17
$\begingroup$

There is a secret operator $F$ that takes two whole numbers and outputs a new number. For example

$$\begin{split}F(6,9) &= 15\\ F(66,11) &= 110 \\ F(86,18) &= 179\end{split}$$

Can you find what $F$ does and what is the output of $F(601,81)$ ?

Hint:

F may not be defined for all inputs

$\endgroup$
7
  • 9
    $\begingroup$ I LaTeXed your question! $\endgroup$ Commented Jul 15, 2020 at 8:04
  • 3
    $\begingroup$ does F always produce whole, positive integers when given whole numbers? Because if not, you can always solve $F(x,y)=ax + by + c$ for a,b,c and get a very, very ugly result. $\endgroup$
    – subrunner
    Commented Jul 15, 2020 at 8:40
  • 1
    $\begingroup$ @subrunner What if it is a non-linear operator? I suspect there is some concatenation involved. $\endgroup$
    – Earlien
    Commented Jul 15, 2020 at 9:03
  • $\begingroup$ Given the description, $F$ sounds more like a function than an operator. $\endgroup$
    – Earlien
    Commented Jul 15, 2020 at 9:11
  • 3
    $\begingroup$ @brady-gilg The word operator has several meanings, and you'd have to settle on one to make an exact distinction. In computer language design, for example, operator generally means "function of one or two variables that is written in a prefix or infix form". Thus - is a unary operator because -x applies the operator to the variable x, and + is a binary operator because x+y applies the operator to x and y. $\endgroup$ Commented Jul 15, 2020 at 17:40

2 Answers 2

36
$\begingroup$

The answer could be:

Rotating the whole numbers, rather parameters, and not the individual integers, by 180 degrees and adding them together.

$F( 6, 9) \quad\rightarrow 9 + 6 \quad= 15$
$F(66,11) \rightarrow 99 + 11 = 110$
$F(86,18) \rightarrow 98 + 81 = 179$

Therefore the output of $F(601, 81)$ would be

$109 + 18 = 127$

$\endgroup$
4
  • 9
    $\begingroup$ +1 for sheer mindbending non-mathematical genius! Now I know why the question wasn't tagged 'mathematics' :) $\endgroup$
    – subrunner
    Commented Jul 15, 2020 at 9:35
  • 3
    $\begingroup$ Hi Ewasted and welcome to Puzzling! It would improve your answer to be more specific about what 'flipping' means in your answer. If you could explicitly mention rotation instead in your answer it would be much clearer. (To me, flipping 601 could mean either (i) reversing the digits to 106 or flipping each individual digit across its horizontal axis to get 901 - neither of these is quite what you mean!) Thanks :) $\endgroup$
    – Stiv
    Commented Jul 15, 2020 at 9:35
  • 3
    $\begingroup$ Sorry, I fixed it now :-) $\endgroup$
    – user70448
    Commented Jul 15, 2020 at 9:46
  • 1
    $\begingroup$ You got it. Well done! $\endgroup$ Commented Jul 15, 2020 at 10:52
7
$\begingroup$

For what it's worth, here's the solution as a short C# program. No string operations necessary :)

void Main()
{
  F(6,9).Dump();      //  15
  F(66,11).Dump();    // 110
  F(86,18).Dump();    // 179
  F(601,81).Dump();   // 127
 }

 int F(int x, int y)
 {
  return rotate(x)+rotate(y);
 }

 int rotate(int num)
 {
  int result =0;
  for (; num > 0; num /= 10)
  {
      int digit = num % 10;
      switch (digit)
      {
          case 0: case 1: case 2: case 5: case 8: break;
          case 3: case 4: case 7: throw new ArgumentException($"can't flip {digit}");
          case 6: digit = 9; break;
          case 9: digit = 6; break;
          default: throw new ArgumentException("I can't even");
      }
      result = result * 10 + digit;
  }
  return result;
 } 

$\endgroup$
3
  • $\begingroup$ Really nice. Could the 'rules' be changed so the number remains as is if it can't be rotated? $\endgroup$ Commented Jul 16, 2020 at 21:07
  • $\begingroup$ Sure, although that goes against the Hint at end of the question here. But if you want: just change the line with can't flip {digit}, replacing the word throw and everything after it with break; $\endgroup$ Commented Jul 16, 2020 at 21:24
  • 1
    $\begingroup$ I didn't see the hint at first. $\endgroup$ Commented Jul 17, 2020 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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