# Interview riddle

On the Mathematics chat we were recently talking about the following problem @Chris'ssis had to solve during an interview :

$$3\times 4=8$$ $$4\times 5=50$$ $$5\times 6=30$$ $$6\times 7=49$$ $$7\times 8=?$$

We have not managed to solve it so far, all we know is the solution (which was given after we had given up) :

$224$

How do we find this solution ?

• What kind of interview was this? I hate it when people use equals signs to describe relations that aren't equal. Commented Jul 14, 2014 at 14:05
• "interview" and "riddle" - unless you're Tom Riddle and you're interviewing somewhere, you should never hear those two words in the same sentence. =( Commented Jul 14, 2014 at 17:35
• That interview question is good sign that it's time to walk out the door.
– RQDQ
Commented Jul 14, 2014 at 17:48
• I would probably have taken this question as a challenge to convince the interviewer that the answer isn't 224. The question is arbitrary, so it really just comes down to a battle of wills. Bonus points if you make the interviewer cry while he concedes your answer. Commented Jul 14, 2014 at 21:02
• @DanielV: further bonus points if you can get the person you'll be negotiating salary with in on the discussion. "Your salary will be 56K", "excellent, and 56 = 7 * 8 = 224, so what's 224k after tax and what's the dental plan?" Commented Jul 14, 2014 at 23:32

These interview problems are sometimes weird, where notations are bad, rules are arbitrary, and they expect only one answer where several could fit.

Here is one, which could be the expected one, but probably not:

To compute $a \times b$, take the numerator of $\dfrac{ab^2}{6}$ after simplification of the fraction.

I don't see how they could argue it is wrong.

• Holy **** how can you come up with this answer?? Commented Jul 15, 2014 at 3:31
• +1 "I also don't like these problems, where notations are bad, rules are arbitrary, and they expect only one answer where several could fit." Commented Jul 15, 2014 at 8:44
• @HoàngLong similarly to anorton's answer: I entered the sequence of quotients 2,10,5,7,28 in OEIS, then people helped to simplify it in this particular case (see the comment of Joseph Geipel) Commented Jul 15, 2014 at 15:25
• @Denis Hahahah! I did the same thing! Go OEIS :) Commented Jul 16, 2014 at 5:04
• @hims056 $\frac{4*5^2}{6}=\frac{50}{3}$ so the numerator is $50$. Commented Jul 16, 2014 at 11:28

Easy, just define

$$\begin{array}{rcl}a \times b &=& \hspace{10.5pt}(a-4)(b-5)(a-5)(b-6)(a-6)(b-7)(a-7)(b-8)/72 + \\&& 25(a-3)(b-4)(a-5)(b-6)(a-6)(b-7)(a-7)(b-8)/18 + \\&& 15(a-3)(b-4)(a-4)(b-5)(a-6)(b-7)(a-7)(b-8)/8 \hspace{5.25pt}+ \\&& 49(a-3)(b-4)(a-4)(b-5)(a-5)(b-6)(a-7)(b-8)/36 + \\&&\hspace{5.5pt}7(a-3)(b-4)(a-4)(b-5)(a-5)(b-6)(a-6)(b-7)/18\end{array}$$

• You mean $\frac{181 a ^{4} b ^{4} - 4318 a ^{4} b ^{3} + 37880 a ^{4} b ^{2} - 144623 a ^{4} b + 202440 a ^{4} + -3594 a ^{3} b ^{4} + 85893 a ^{3} b ^{3} - 754833 a ^{3} b ^{2} + 2886774 a ^{3} b - 4047120 a ^{3} + 26012 a ^{2} b ^{4} - 622766 a ^{2} b ^{3} + 5482627 a ^{2} b ^{2} - 21003793 a ^{2} b + 29493240 a ^{2} + -81093 a b ^{4} + 1944783 a b ^{3} - 17150580 a b ^{2} + 65813730 a b - 92559600 a + 91560 b ^{4} - 2199120 b ^{3} + 19423320 b ^{2} - 74648280 b + 105134400}{36}$? Commented Jul 15, 2014 at 8:30
• @AxelKemper Multiplication has never looked so epic! Commented Jul 15, 2014 at 8:34
• Holy Mother God!
– MonK
Commented Jul 15, 2014 at 18:09
• Hilarous $\phantom{}$
– Newb
Commented Jul 15, 2014 at 19:41
• This is obviously the answer. How can it be anything else. Commented Jul 21, 2014 at 13:55

This might be a possible solution. For a positive integer $n$, let $\nu_2(n)$ be the largest $k$ such that $2^k|n$, and similarly, let $\nu_3(n)$ be the largest $k$ such that $3^k|n$. Finally let $$h(n)=\frac{n}{3^{\nu_3(n)}2^{1+4\lfloor \nu_2(n)/4\rfloor}}$$ If we consider $$a\times ~ b {\buildrel \rm def\over =}~b h(ab)$$ then $(k-1)\times k$ coincides with the proposed results for $k=4,5,6,7$ and yields $224$ for $k=8$.

• Your answer made me laugh just trying to imagine an interviewer who could comprehend such a rule let alone expect anyone to come up with it on the spot during an interview. Commented Jul 14, 2014 at 17:20
• @heropup, So, you understand my feelings while trying to to write it down! :) Commented Jul 14, 2014 at 17:57
• How in the world did you come up with this? Commented Jul 14, 2014 at 18:38
• I don't even... Commented Jul 15, 2014 at 13:03
• Plot twist: @OmranKouba was the interviewer all along Commented Jul 16, 2014 at 5:41

The left-hand-side input and the right-hand-side output can be imagined as binary numbers in a kind of truth table:

All eight output bits can be calculated from the seven input bits evaluating simple Boolean expressions.

• I figured binary boolean logic was involved. However, without knowing the final answer to the question, you wouldn't come up with the right answer, because without knowing from 7x8=224 that h=i=d, and also not knowing that results larger than 6 bits exist, your method would give you an answer of just 100000 (32). Commented Jul 14, 2014 at 20:59
• +1 for the analysis though. Commented Jul 14, 2014 at 21:04
• All the operations are very arbitrary, though. Given just the first 4 and no solution, you could do many distinct operations for each digit and get many different solutions. You could make the "answers" to the "equations" just about any 5 numbers and come up with binary operations
– Khan
Commented Jul 15, 2014 at 16:56
• where is 'L' and 'O' ? Commented Jul 16, 2014 at 5:25
• @Awal: Developers often skip l and o to avoid confusions. Now, I seem to have confused you? Commented Jul 16, 2014 at 6:34

Spoiler Alert: (I use the answer given above in the response below. If you don't want to see it, you may want to skip this answer...)

I'm replacing $\times$ by $\circ$, as the latter is more commonly used with unknown operations. I hate it when people redefine a common symbol, then "$=$" to describe a relationship.

Note that \begin{align}3\circ4 &= 4\cdot 2\\ 4\circ 5 &= 5\cdot 10\\ 5\circ 6 &= 6\cdot 5\\ 6\circ 7 &= 7\cdot 7 \\ 7\circ 8 &= 8\cdot 28 \\ \end{align}

Thus, we can define: $$a\circ b\quad{\buildrel \rm def\over =}\quad b\cdot x_a$$ Where $x_n$ is some sequence. OEIS yields three possible sequences: $$x_n = \frac{\binom{n+2}{2}\gcd(n,3)}{3},\quad n \ge 0$$ (A234041) $$x_n = \text{denominatorOf}\left(\frac{(n-2)(n+3)}{(n)(n+1)}\right)\quad n \ge 3$$ (A027626: GCD of $n$-th and $(n+1)$st tetrahedral numbers, offset by me for this problem)

The last sequence from OEIS is A145911 which is not promising at all. (It's a combination of, what appears to be, $3$ other sequences.)

• Note: I may have goofed up in how I offset the sequence, but I think I did it right... Commented Jul 14, 2014 at 18:21
• To me, this confirms that the interviewer is smoking crack. Commented Jul 14, 2014 at 18:24
• I agree with @heropup, although it does depend what the job is for. I mean, if this is a job ad for some mathematics specialist, then ... maaaybe ... Commented Jul 17, 2014 at 1:05
• If you search the first 4 terms of $x_a$ on OEIS, the 5th term in the first few results is 28, so that's a way this could plausibly be "solved". Commented Jul 20, 2014 at 15:36

The answer is $42$.

$69$ is also the answer.

"Purple feelings" is also an answer.

The truth of each of these is, of course, vacuous. :)

If the question is posed as something other than multiplication, then it is the fault of the questioner for miscommunicating.

Although, one could arguably blame the person trying to solve this problem for not doing enough to extract enough requirements from the 'customer' to be able to provide a solution. In some settings, this is an extremely important skill.

56 Did the question explicitly say there was a pattern to be found or is it just like you've presented it here? The symbols for multiplication(x) and equality(=) have well defined mathematical meaning and therefore 7 x 8 = 56 regardless of what misleading noise was written before. It may just be a test of the ability to avoid presumption.

• That is one approach, but there are a large class of problems like this (although I hate them all) that redefine either $=$ or $\times$. This is, most likely, one of these problems. Commented Jul 15, 2014 at 3:24
• +1. If you want to redefine standard mathematical operations, you should say so. Otherwise, stick to mathematical convention. If you want me to solve a "mathematics" puzzle and can't manage to bring it across properly, I don't expect we'll be able to communicate very well and this is probably not a person I want to work for :) Commented Jul 15, 2014 at 9:20

$$p(x)=$$

$$-\frac{1486263915627335609976345925580307452480}{198824918770116952269605821139049374259}-\frac{23535858736574459335924875719051524464677 x}{1789424268931052570426452390251444368331}+\frac{1532186339457747628597246965489647712097745599 x^2}{742539494635629574624160683858739355082631760}-\frac{5300973178829466500668773673899060773511329723 x^3}{62373317549392884268429497444134105826941067840}+\frac{425139989729581169917246837619141657974952401 x^4}{374239905296357305610576984664804634961646407040}-\frac{15160892592292573821061148160317799661783 x^5}{7128379148502043916391942565043897808793264896}+\frac{2379833487879115598578638026951579913181 x^6}{1496959621185429222442307938659218539846585628160}-\frac{133849478325585275186149006837381343 x^7}{249493270197571537073717989776536423307764271360}+\frac{9291465647310545015926219743101 x^8}{136087238289584474767482539878110776349689602560}$$

Then
$$\begin{array}{|c|c|c|c|c|c|c|c|c|} \hline x & 12\color{grey}{(3\times 4)} & 20\color{grey}{(4\times 5)} & 30\color{grey}{(5\times 6)} &42\color{grey}{(6\times 7)}&56\color{grey}{(7\times 8)}& \color{grey}{1729}&\color{grey}{2014}&\color{grey}{2015}&\color{grey}{2016}\\ \hline p(x)& 8 & 50 & 30 &49&\color{red}{224}& \color{grey}{1729}&\color{grey}{2014}&\color{grey}{2015}&\color{grey}{2016} \\ \hline \end{array}$$

To learn to play this 'game', read me.

• I was tempted to write a similar solution :) an interpolating polynomial. Commented Jul 21, 2014 at 14:03

Here is something I did which lead me to an incorrect result, but it is still pretty close.

Since all the values we are given are of the form $a\times (a+1)$, I decided to make the function $f(a)=a\times (a+1)$. Assuming $f$ is a polynomial of grade $4$ or less we obtain $f$ is equal to $\frac{101 x^3}{6}-233 x^2+\frac{6301 x}{6}-1500$ using interpolation.

This function gives us $f(7)=208$, which comes close, but is still not correct.

• The f function in not incorrect, although it may yield defferent result from that in the "supposed" answer. Commented Jul 16, 2014 at 7:50
• Haha, well I guess you are right, I don't think anyone would have arrived at the "correct" solution if they hadn't provided it. Commented Jul 16, 2014 at 13:22
• "Correct" in the context of this interview question seems to mean someone thinking the same way they do. My alternative answer is (101 b^3)/6 - (567 b^2)/2 + (4700 b)/3 - 280, which gives the same answer as yours. Therefore, our answers are correct because we think the same way Commented Aug 26, 2023 at 12:43

This is what I have so far, it seems a bit more intuitive than Omran's solution.

Based on the flip-flopping numbers, I figured the answer has to rely on the prime factorization of the numbers in question. So in particular, we see:

$$3 \times 2^2 \Rightarrow 2$$ $$2^2 \times 5 \Rightarrow 2*5$$ $$5 \times 2 * 3 \Rightarrow 5$$ $$2 * 3 \times 7 \Rightarrow 7$$ $$7 \times 2^3 \Rightarrow 2^2*7$$

So my initial hypothesis, which is that you took the highest prime and any primes with power greater than $1$ fails for the first equation. But it does look like a promising lead.

• I reached the same conclusion (and honestly reached it, unlike my comment to boywholived where I clearly lied through my teeth). Prime factorization plays a role somehow. Commented Jul 16, 2014 at 17:57

One solution is to define the operation $\times$ between two integers as

$m \times n = n \cdot \left\{ \begin{array}{ll} \frac{1}{3}\sum_{k=1}^m k &\mbox{if } 3 \mid \sum_{k=1}^m k \\ \sum_{k=1}^m k &\mbox{otherwise.} \end{array} \right.$

The point is, that what remains of the RHS after dividing by $n$ can be recognized as the sum of the first $m$ integers, divided by $3$ should that be possible.

numbers sequence

3 . 4 = 4 X 2 = 8

4 . 5 = 5 X 10 = 50

5 . 6 = 6 X 5 = 30

6 . 7 = 7 X 7 = 49

7 . 8 = 8 X 28 = 224

8 . 9 = 9 X 4 = 36

9 . 10 = 10 X 5 = 50

10 . 11 = 11 X 55 = 605

11 . 12 = 12 X 11 = 132

12 . 13 = 13 X 13 = 169

13 . 14 = 14 X 91 = 1274

14 . 15 = 15 X 7 = 105

15 . 16 = 16 X 8 = 128

16 . 17 = 17 X 136 = 2312

17 . 18 = 18 X 17 = 306

18 . 19 = 19 X 19 = 361

19 . 20 = 20 X 190 = 3800

20 . 21 = 21 X 10 = 210

a.(a+1) = (a+1)x((a+1)/2) - even number/2

b.( b+1) = (b+1)x(((a+1)/2 )xc)) - middle of the sandwich

c.(c+1) = (c+1)xc

d.(d+1) = (d+1)x(d+1) - odd number - copy

e.(e+1) = (e+1)x((d+1)x(f/2))

f.(f+1) = (f+1)x(f/2)

a+1=b, b+1=c,…

The problem is more about finding the patterns and relations between numbers and given equations.

3×4=8
4×5=50
5×6=30
6×7=49
7×8=?

There are some assumptions that have to be made:
1) look at the given equations as a sequences of numbers (sequences is plural - not just one sequence)
2) results on the right side can always by divided by the second number on the left side 8:4=2, 50:5=10, 30:6=5, 49:7=7 => the result of the last equations is therefore multiple of 8 => 7x8=8x?=???
(Note: Why did they use "x" when multiplication is clearly not what is done with those numbers? Why not better use symbol ∘ for unknown operations? My guess is - it's also a hint.... multiplication is necessary in the answer. ....so don't try to come up with solutions that are more complex than that ;-) But that's just my guess)
3) we can write down what we assume so far:
3 ∘4 = 4 X 2 = 8
4 ∘ 5 = 5 X 10 = 50
5 ∘ 6 = 6 X 5 = 30
6 ∘ 7 = 7 X 7 = 49
7 ∘8 = 8 X ?=???
5) we can also say that after 7∘8=8x??? some other equations should follow and the patter we know so far is is:

8 ∘9 = 9 X ?=???
9 ∘10 = 10 X ?=???

5) now look at the numbers sequence (fourth number in each equation): 2, 10, 5, 7, ... there are of course many things we can do (2+8=10, 10-5=5, 5+2=7,etc.)... but we also have a possible relation to 3.4, 4.5, 5.6,6.7
6) the easy patter would be "sandwich"- second number = first*third
7) how to define first and third number? - check the relation with 3.4 and 5.6 and first number also has a relation to 7.7
..the rest I already explained in the comment section below ;-)

• Could you elaborate how you got to these answers? Commented Jul 15, 2014 at 13:06
• Where did you get that sequence? Did you just make it up? Commented Jul 15, 2014 at 13:12
• i made excel spreadsheet with formulas to calculate the fourth number. Commented Jul 15, 2014 at 14:12
• the fourth number sequence is 2, 10, 5, 7, 28, 4, 5, 55, 11, 13, 91, 7,….etc Commented Jul 15, 2014 at 14:15
• 1) make groups of 3 numbers:second number 10 is 2*5(first*third number) Commented Jul 15, 2014 at 14:18

The first multiplicant is given. So the open question is "what is the second multiplicant"?

The list can be grouped in sixes. So lines 1-6 is one group, the rules count for each group.

• Define fm as the given first multiplicant of the row. Start with 4. Increment fm by one on each row
• Set cm (current multiplicant) to 1
• The result for each row is result = fm * cm. You only change cm from row to row

These are the rules for the six rows

1. cm := cm + 1
2. cm := fm * cm
3. cm := fm - 1
4. cm := fm
5. cm := cm * fm / 2
6. cm := (fm - 1) / 2

The sequence of cm would be

2, 10, 5, 7, 28, 4, 5, 55, 11, 13, 91, 7, 8, 136, 17, 19, 190, 10

I think you can continue like that

• In order to add to @user164475's result I give the result for 21 . 22 = 22 X 11 = 242 Commented Jul 15, 2014 at 13:59

The answer stares you right in the face.

7 x 8 is a question mark.

Now I should add that one moderator apparently believed this was a joke answer. It should be obvious that it isn't. If I wanted to make a joke, I would have added a comment. Mathematics is about the manipulation of symbols, and this is an example of symbol manipulation creating a riddle with the answer hidden in plain sight.

The riddle equates various symbols resembling products with other symbols in a rather pointless way. The question of the riddle is what the last symbol "7 x 8" equates. It obviously is meant to equate whatever symbol is to the right of the "=" sign.

There is one answer here by maddog2k that I would consider better (that 7 x 8 = 56, since we shouldn't care about all the wrong answers given in the riddle but just give the correct answer).

• I don't think this is a joke answer. But I'm not a mod, either.
– Almo
Commented Jul 18, 2014 at 13:58
• In it's present form, this answer is clearly not a joke. In it's prior form, I thought that it was certainly one. Currently, though, I think this (and maddog2k's) answer are stubborn responses to the format of the question: instead of trying to solve the presented problem, these responses pick at the method through which the problem is conveyed. The ? and the x characters are artifacts of how the question is presented, not part of the problem itself. (My opinion, yours may differ.) Commented Jul 19, 2014 at 21:29

Surely even this interviewer meant for $$\times$$ to be commutative, so I propose $$a \times b = \left( \binom{a+1}{3},\binom{b+1}{3} \right) \cdot \max(a,b)$$ where the inner brackets are binomial coefficients, and the outer brackets indicate the gcd.

$A\cdot B = C$

$\dfrac{AB²}{\gcd(AB²,6)} = C$ or $\dfrac{\text{lcm}(AB²,6)}6 = C$

We rewrite the riddle using prime decomposition.

Notation: $$2^{x_1}3^{x_2}5^{x_3}7^{x_4}\leftrightarrow (x_1,x_2,x_3,x_4)$$ We have: $$(a_1,a_2,a_3,a_4) \odot (b_1,b_2,b_3,b_4) = (c_1,c_2,c_3,c_4)\\ (0,1,0,0) \odot (2,0,0,0) = (3,0,0,0)\\ (2,0,0,0) \odot (0,0,1,0) = (1,0,2,0)\\ (0,0,1,0) \odot (1,1,0,0) = (1,1,1,0)\\ (1,1,0,0) \odot (0,0,0,1) = (0,0,0,2)\\ (0,0,0,1) \odot (3,0,0,0) = ?$$ We note that the following definition of $$(c_1,c_2,c_3,c_4)$$ satisfy the given relations: $$c_1=a_2+a_3+b_1+b_3-b_2-b_4+2a_4\\ c_2=a_3\\ c_3=a_1+b_2-b_4\\ c_4=a_4+2b_4\\$$

We then calculate: $$(0,0,0,1) \odot (3,0,0,0)=(5,0,0,1) \leftrightarrow 2^57=224$$

We note though that $$a_4$$ can appear anywhere and satisfy the given relations namely the riddle can have multiple answers. Knowing the answer is $$224$$ we can include $$a_4$$ in the defining relation of $$c_1,c_4$$.