# What is the secret operator?

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

• I LaTeXed your question! – Culver Kwan Jul 15 '20 at 8:04
• 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. – subrunner Jul 15 '20 at 8:40
• @subrunner What if it is a non-linear operator? I suspect there is some concatenation involved. – Earlien Jul 15 '20 at 9:03
• thanks for latexing – Dmitry Kamenetsky Jul 15 '20 at 9:25
• @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. – Ross Presser Jul 15 '20 at 17:40

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$$

• +1 for sheer mindbending non-mathematical genius! Now I know why the question wasn't tagged 'mathematics' :) – subrunner Jul 15 '20 at 9:35
• 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 :) – Stiv Jul 15 '20 at 9:35
• Sorry, I fixed it now :-) – Ewasted Jul 15 '20 at 9:46
• You got it. Well done! – Dmitry Kamenetsky Jul 15 '20 at 10:52

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;
} 

• Really nice. Could the 'rules' be changed so the number remains as is if it can't be rotated? – JosephDoggie Jul 16 '20 at 21:07
• 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; – Ross Presser Jul 16 '20 at 21:24
• I didn't see the hint at first. – JosephDoggie Jul 17 '20 at 12:07