Are you, like, a crazy person?

Logic Level 5

0 = 2 3 4 + 5 1 = ( 2 3 ) × ( 4 5 ) 2 = 3 2 4 + 5 3 = 2 × ( 3 4 ) + 5 4 = 2 + 3 + 4 5 5 = 2 3 × ( 4 5 ) \begin{aligned} 0 &=& 2 - 3 - 4 + 5 \\ 1 &=& (2-3) \times (4-5) \\ 2 &=& 3 - 2 - 4 + 5 \\ 3 &=& 2 \times(3-4) + 5 \\ 4 &=& 2 + 3 + 4- 5 \\ 5 &=& 2 - 3\times(4-5) \\ \end{aligned}

Above shows the first 6 non-negative integers formed by using the four mathematical operators ( + × ÷ + \ - \ \times \ \div ) from the integers 2, 3, 4, 5 (each of which is used exactly once).

What is the smallest positive integer that cannot be represented using these conditions?

Details and Assumptions :

  • You are not allowed to join digits together: 2 + 34 + 5 2+34+5 .
  • You don't have to keep the digits in order. e.g.: 2 + 5 3 4 2+5-3-4 .


The answer is 32.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

6 = 2 × 3 × ( 5 4 ) 7 = 5 + 2 × ( 4 3 ) 8 = 4 + 2 × ( 5 3 ) 9 = 5 + 4 × ( 3 2 ) 10 = ( 5 3 ) + ( 4 × 2 ) 11 = 5 + 3 × ( 4 2 ) 12 = ( 5 + 4 3 ) × 2 13 = ( 4 + 2 ) × 3 5 14 = ( 5 × 4 ) ( 3 × 2 ) 15 = ( 5 × 4 ) 3 2 16 = ( 5 + 3 ) × ( 4 2 ) 17 = ( 5 × 3 ) + ( 4 2 ) 18 = ? ? ? T r y 1 19 = ( 4 × 3 × 2 ) 5 20 = ( 5 + 3 ) × 2 + 4 21 = ( 5 × 3 ) + 4 + 2 22 = ( 5 × 2 ) + ( 3 × 4 ) 23 = ( 5 × 3 ) + ( 4 × 2 ) 24 = 2 × ( 3 + 4 + 5 ) 25 = ( 2 + 3 ) × 4 + 5 26 = ( 4 × 5 ) + ( 2 × 3 ) 27 = ( 2 + 4 ) × 5 3 28 = ? ? ? T r y 2 29 = 5 × ( 2 + 3 ) + 4 30 = ( 3 + 5 ) × 4 2 31 = ( 2 + 5 ) × 4 + 3 32 = ? ? ? T r y 3 33 = 5 × ( 4 + 2 ) + 3 6=2\times 3\times (5-4)\\ 7=5+2\times (4-3)\\ 8=4+2\times (5-3)\\ 9=5+4\times (3-2)\\ 10=(5-3)+(4\times 2)\\ 11=5+3\times (4-2)\\ 12=(5+4-3)\times 2\\ 13=(4+2)\times 3-5\\ 14=(5\times 4)-(3\times 2)\\ 15=(5\times 4)-3-2\\ 16=(5+3)\times (4-2)\\ 17=(5\times 3)+(4-2)\\ 18=???Try\quad 1\\ 19=(4\times 3\times 2)-5\\ 20=(5+3)\times 2+4\\ 21=(5\times 3)+4+2\\ 22=(5\times 2)+(3\times 4)\\ 23=(5\times 3)+(4\times 2)\\ 24=2\times (3+4+5)\\ 25=(2+3)\times 4+5\\ 26=(4\times 5)+(2\times 3)\\ 27=(2+4)\times 5-3\\ 28=???Try\quad 2\\ 29=5\times (2+3)+4\\ 30=(3+5)\times 4-2\\ 31=(2+5)\times 4+3\\ 32=???Try\quad 3\\ 33=5\times (4+2)+3

18 = 3 × ( 2 × 5 4 ) , 28 = 4 × ( 2 × 5 3 ) 18 = 3\times (2\times5 -4), 28 = 4\times (2\times 5-3) .

Yay! You got the reference!

Pi Han Goh - 6 years ago

Log in to reply

BTW for 4 we also have ( 4 2 ) × ( 5 3 ) (4-2) \times (5-3) as another possible solution. And 3 can also be expressed as ( 4 3 ) × ( 5 2 ) (4-3) \times (5-2) .

Noel Lo - 5 years, 11 months ago

How was I supposed to get it, trial and error is the only way?

Mardokay Mosazghi - 5 years, 5 months ago

Log in to reply

Read the title of this problem.

Pi Han Goh - 5 years, 5 months ago

Log in to reply

@Pi Han Goh wow you got me there!

Mardokay Mosazghi - 5 years, 5 months ago

Yup! Cannot forget a line from a movie. And how in the world did I miss that! Makes sense that I didn't get both. :/ Can we prove that 32 is impossible?

Raghav Vaidyanathan - 6 years ago

Log in to reply

I'm not sure how to attempt this. Sounds like a NP problem. Got any idea?

Pi Han Goh - 6 years ago

Log in to reply

@Pi Han Goh I think we can brute force it by taking all permutations of numbers and operators(using a computer of course). But otherwise, I am as clueless as you are.

Raghav Vaidyanathan - 6 years ago

@Pi Han Goh Is there any relation between:

Hey 32 32 is not a polite number! and,

this question?

@Raghav Vaidyanathan @Pi Han Goh

Sravanth C. - 6 years ago

Log in to reply

@Sravanth C. 32 32 is not a polite number -_- .Please review their definition again!

Nihar Mahajan - 5 years, 12 months ago

Log in to reply

@Nihar Mahajan Thanks! edited.

Sravanth C. - 5 years, 12 months ago

Log in to reply

@Sravanth C. Then by your reasoning , even 2 , 4 , 8 , 16 2,4,8,16 are impolite. Then why can they be represented whereas 32 32 cannot be represented?

Nihar Mahajan - 5 years, 12 months ago

Log in to reply

@Nihar Mahajan Yeah. I was thought about that too, but I think there is some relation . . .

Sravanth C. - 5 years, 12 months ago

@Pi Han Goh Actually , it can be proved or at least pointed out clearly that 32 is an impossible case if you are a little bit attentive. Observe that the 4 numbers can have only operations possible with those 4 operators and therefore there will 3 operators used in each possible expression. Now observe that there can be at most 3 different used and that for 32 this cases can be thought of in some terms regarding their quantity being possible to firstly prove that there is necessary at least one * operator because addition would give at most 14. From this there are some other cases in which either there is only one * operator used or more and for using just a single operator then it means that there is a number from those numbers which multiplied with the result (or combination) of the expression of the other 3 gives 32. That number then will either divide 32 and those numbers can be either 4 or 2 but doesn't give a solution or can't divide it and then those numbers are resulting numbers from the combination of 2 other numbers which should give the expression of 4 * 8 ( because the other possibility 2*16 is already included in the other case and therefore would be fallacious to put it here since 2 is already included and there is no way to get 16 also). However there can't be obtained by the combination of 2 terms 4 and also 8 and I'll not put the details either. Therefore there are exhausted all the possible simplified cases for one * operator of the numbers , since there are used in this cases the multiplication between already given terms and the result of the other 3 and also the combination of the results of combinations of numbers. For the case where there are used more than just 1 * operator observe that the result grows pretty big or pretty small and therefore implies in the cases where the resulting number is bigger the / operator but those cases are easy to check from there. Therefore , it is impossible and while maybe there is possible a synthetic approach using the number of terms which imply some operator and the quantitative relations between consecutive numbers this can be sufficient to see by some understanding of their relations. In this way there is some organizing of those stuff so that there can be said that is pointed out or proved why it is not possible. Such an approach considers what can be called the way such number behave under this operations and develops an understanding of it which in more or less a way can be said that is also the understanding which is tried to be achieved in such "arithmetic" questions anyways.

A A - 5 years, 1 month ago

Log in to reply

@A A I appreciate your detailed writeup, but your explanation lacks rigor. If I replace the numbers 2,3,4,5 with some other 4 consecutive integers, I'm pretty sure your argument will not hold.

Pi Han Goh - 5 years, 1 month ago

Log in to reply

@Pi Han Goh Oh , of course it wouldn't. I just wanted to prove it for this case as it at least to me seems requested.

A A - 5 years, 1 month ago

Log in to reply

@A A Oh okay! Great! I see that you're solving plenty of my problems lately. Haha!

Pi Han Goh - 5 years, 1 month ago

Log in to reply

@Pi Han Goh Yea , a lot of them wrongly too anyways and they are cute. I have an unclarity at "large tic tac toe 4" cause I think there is a solution in 5 steps of X but I doubt I'm right. Hope you'll solve mine's too when you will want and have time and I'll post a new one also. Anyways , regarding this problem I thought at a synthetic solution for this particular case (using the 4 consecutive numbers in the problem) but I'm not done yet. Understanding this kind of things to me almost always implies getting them by the principles. It may be that it is NP indeed thought first thought can be misleading without rigor and a solution by checking cases even if is a solution can still be understood more or less rationally relating the ordering of the procedure and stuff like that , I'm rarely satisfied (even if for practical uses it may be enough) with just checking cases.

A A - 5 years, 1 month ago

Log in to reply

@A A Feel free to report my question, I'll respond to it when I'm free.

Pi Han Goh - 5 years, 1 month ago

I listed every possible outcome, or all the numbers possible with 2 , 3 , 4 , 5 2,3,4,5 . I'm crazier than u hahahahhavabipjdknva

Julian Poon - 6 years ago

good solution

Rama Devi - 6 years ago

I assume that BIDMAS is completely disregarded in thus problem

Jack McInerney - 5 years, 5 months ago

You are as crazy as me. My first try was 20 and then 31. And then I tried getting 32, coundn't. I got 33 and couldn't get 34. After trying literally everything, I HOPED 32 would be the answer (since I had only 1 try left). And... Bingo!

Dejan Tomić - 5 years, 4 months ago

I wrote a python program to attempt and calculate all the possible value which can be formed by 2,3,4,5. Basically a brute force and not really optimized since we are interested only for small numbers.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import math
dp_set={}

def splits(a):
    l=len(a)
    final=[]
    for i in range(1,2**l-1):
        a1=[]
        a2=[]
        for j in range(0, l):
            if(2**j & i ):
                a1.append(a[j])
            else:
                a2.append(a[j])
        final.append([a1,a2])
    return final

def calc_val(a):
    if len(a)==1:
        return a
    if str(sorted(a)) in dp_set:
        return dp_set[str(sorted(a))]
    final=[]
    for i in splits(a):
        a1=i[0]
        a2=i[1]
        j=calc_val(a1)
        k=calc_val(a2)
        for v1 in j:
            for v2 in k:
                if (v1+v2) not in final:
                    final.append(v1+v2)
                if ((v1-v2)>=0) and (v1-v2) not in final:
                    final.append(v1-v2)
                if (v1*v2) not in final:
                    final.append(v1*v2)
                if (v2!=0) and (v1%v2==0) and ((v1/v2) not in final):
                    final.append(v1/v2)
    final=sorted(final)
    dp_set[str(sorted(a))]=final
    return final
print calc_val([2,3,4,5])

The values I got [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 48, 49, 50, 52, 54, 55, 58, 62, 64, 66, 68, 70, 84, 90, 100, 120]

Which proves that the smallest such number is 32 With a small code change you can also get the actual expression for this value.

Ajay Brahmakshatriya , we really liked your comment, and have converted it into a solution. If you subscribe to this solution, you will receive notifications about future comments.

Brilliant Mathematics Staff - 5 years, 11 months ago
Steven Perkins
Jun 10, 2015

I wrote a computer program (a while back) that was adaptable to this. I confirmed that 32 was the first positive integer not obtainable.

Of course, if you throw in square roots and powers you get much farther. Add factorials, ...

Yes, I'm like a crazy person!

Can you add the code that you used?

Calvin Lin Staff - 5 years, 12 months ago

Log in to reply

It's not very elegant (and very long) C code from many years ago. The Python code already posted is certainly more instructive.

Steven Perkins - 5 years, 12 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...