35
$\begingroup$

The solution to this puzzle is one I came up with when working on this puzzle: What is the answer of this math puzzle?

For two natural numbers a,b, can you figure out how a#b is defined, going from the following examples?

2#0 = 10
2#2 = 2
2#16 = 8
3#3 = 3
4#9 = 3
5#5 = 5
5#11 = 7
5#17 = 9
6#13 = 7
9#12 = 12
9#16 = 16
10#3 = 7

8#8=2
13#13=19

9#4=2

3#0=10
4#0=10

0#6=2
0#7=3

1000#1000=3000

0#5=5
0#8=2
0#12=4

5#23=3
5#31=3

0#0=2

52#3=3
53#1=3

41#43 = 3
43#41 = 3

1#0 = 10
5#0 = 10

20#0 = 20

4#1 = 3
100#1 = 3

1#8 = 2
1#08 = 4

1#234 = 2
12#34 = 2
123#4 = 4

Following this rule, work out 3#19.


This is a mathematical puzzle, i.e., all numbers actually represent numbers and not letters of the alphabet. Also for the input the numerical value of the inputs and their representation are relevant, not the number of holes, its English name or anything like that. Programming and similar technical help can help, but is not required.


If it takes a while until it is solved, I would like to make this puzzle a bit more interactive. Instead of (or in addition to) giving hints, I will provide more examples on some of your suggested inputs that you think will help you find the pattern.


(The missing hints are the examples that have been added to the list of examples above)

Hint #7:

While it should be possible to write a#b as a single function, it is much easier and more intuitive to think of it as a procedure that takes the inputs and performs some algorithmic steps.

Hint #10:

There are no explicit "magic constants" involved (e.g., divide by 3). Someone mathematically interested might however argue that there is one implicit constant involved.

Hint #11:

0x2#0x2=2

0xF#0xF=3, however 15#15=5 (which should clarify the last hint)

Hint #13:

The operator utilizes concatenation.

Hint #16:

The observations made by theozh and tehtmi - specifically that the result is divisible by 2 and/or 5 iff b is divisible by 2 and/or 5 - holds in general (in base 10).

Hint #17:

This hint might have been really helpful, but I spilled my drink on my notepad and now it's unreadable because of a coffee smudge :/

Hint #18:

"The operator is in the best form of its life. It is a hunter and nothing stands in its way. If anything, it stands in the way of its prey. And it only takes out only the biggest prey - size is the only factor."

Hint #5+#12+#19 (merged to reduce confusion):

a#b is always valid and unambiguous in every base larger than 2. It is impossible to get 0 as a result. There is a certain edge case that can only happen in base-2 that one might argue could lead to a#b being undefined. But if you choose to define this edge case as 1 (which is mathematically reasonable) you get, e.g. 0b1#0b1=1 and 0b100#0b1=1. In fact, if the twin prime conjecture holds, there are infinitely many such cases.

Hint #20

Leading zeros do not matter for a but they do matter for b (see 1#8 and 1#08 example)

$\endgroup$
83
  • 4
    $\begingroup$ This would be a hint, so your call when or whether to tell us: Is it always true that a#b=b#a? $\endgroup$
    – quarague
    Commented Jun 19, 2023 at 7:04
  • 7
    $\begingroup$ the # is the function f(x, y) = -0.2679x² + 0.0536y² + 0.6429x - 0.4286y + 11.2857 and the value of 3#19 is approximately 2.7. (note, this should not be taken seriously) $\endgroup$
    – Marius
    Commented Jun 19, 2023 at 8:49
  • 4
    $\begingroup$ the only striking thing for me (so far) is rot13(vs o vf bqq (be rira) gur erfhyg vf nf jryy.). But maybe there will be counter examples in the future? $\endgroup$
    – theozh
    Commented Jun 21, 2023 at 13:27
  • 8
    $\begingroup$ 4 steps? No wonder it's a long standing puzzle, I think elegance in number sequence or similar black box functions comes from the a pattern despite being hard to spot is a straightforward process. Many steps will make the answer feel a bit random I fear. $\endgroup$
    – Fluorine
    Commented May 4 at 21:50
  • 3
    $\begingroup$ @suchislife Everyone has to start somewhere. If you think you know the answer, go for it $\endgroup$ Commented May 8 at 2:37

1 Answer 1

31
+50
$\begingroup$

I think a have a solution. (Except for the very last example,

which I believe is a typo, and should instead be 123#4 = 2.)

Here it is.

Step #1:

Substitute the # symbol with a single decimal digit (let's call it $D$).

Step #2:

Concatenate all the resulting digits, treating the result as a single integer number (in other words, treat the concatenation $a \mathbin\Vert D \mathbin\Vert b$ as a decimal number, let's call it $N$).

Step #3:

If the number ($N$) from the step #2 is a prime, continue with step #6 (i.e., skip steps #4 and #5).

Step #4:

Factorize that number ($N$) and remember its largest prime factor (let's call it $X_D$).

Step #5:

Divide the number ($N$) produced in step #2 by the factor ($X_D$) remembered in step #4, and remember the result of the division (let's call this quotient $Y_D$).

Step #6:

Repeat the previous steps (starting from step #1) for all possible decimal digits (i.e., try all $D$ from 0 through 9), generating a set of pairs: the factors ($X_D$) and their corresponding quotients ($Y_D$).

Step #7:

The final answer (aka the "result of the #-operator") is such a quotient ($Y_D$) that corresponds to the largest factor ($X_D$) from the set generated in step #6.

The exceptional ("edge") case mentioned in the comments:

If $N$ is a prime for every possible digit $D$, the set will be empty. This can only happen in base-2, and only when dealing with so-called twin primes. In this case, the logical answer would be 1 (as when the $N$ is divided by itself due to lack of more suitable candidates).

The answer to the 3#19 example posed in the question is:

13,

because

the largest prime factor is 263, which is when the substituted digit is 4, and then the corresponding quotient is 13, i.e., $3419 = 263 \times 13$.

Also,

the same steps can easily apply to bases other than 10, just instead of decimal digits and numbers, use the digits from the appropriate radix and treat all the numbers accordingly.

$\endgroup$
12
  • $\begingroup$ This sounds like an amazing conclusion to a year's puzzle hunt and the dozens of comments. Also the author's choice of the symbol fits quite well with your solution. By the way what do you make of the cryptic Hint #17? $\endgroup$ Commented Oct 12 at 0:00
  • $\begingroup$ @BenjaminWang Not sure, but perhaps ROT13(orvat haernqnoyr orpnhfr bs n fzhqtr) refers to the fact that ROT13(bar qvtvg vf bofpherq ol gur # flzoby, naq nf fhpu gur chmmyr vf abg (rnfvyl) fbyinoyr hayrff lbh gel bhg nyy cbffvoyr qvtvgf gb erfgber vg svefg. Fvzvyneyl, vs lbh fcvyy n pbssrr ba fbzr grkg, fzhqtvat bar jbeq, lbh arrq gb thrff (oehgr-sbepr) gung jbeq gb haqrefgnaq gur jubyr fragrapr). (Just my 0.02€.) $\endgroup$ Commented Oct 12 at 1:14
  • 2
    $\begingroup$ I can find one more example (perhaps also a typo by the creator): The puzzle states 0#0=2, but your answer is 10 (because of 7). For my script to check the answers, see pastebin.com/ck9aLNcd $\endgroup$ Commented Oct 12 at 5:35
  • $\begingroup$ @BenjaminWang Oh, good catch! You are right. I cannot explain this. Having two typos, especially that one, seems already improbable. :( Now I remember, I had also spotted 0#0=2 at some point and thought that maybe ROT13(vg unf fbzrguvat gb qb jvgu cevzr snpgbe rkcbaragf, zrnavat jura gur fnzr cevzr snpgbe bpphef zber guna bapr, yvxr svir fdhnerq vf 25, fb znlor guvf pbhagf nf n fvatyr snpgbe terngre gung frira. Ohg va gung pnfr, 2#0 jbhyq nyfb or 2, orpnhfr bs svir phorq. Bu, jryy…) Anyway, you've done good job testing, thanks! $\endgroup$ Commented Oct 12 at 8:14
  • 4
    $\begingroup$ It's finally over. I can sleep at night again. $\endgroup$ Commented Oct 13 at 12:41

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.