1
$\begingroup$

Using only the digits in the year 2021 and basic mathematical operations (+, -, × and ÷), how many of the numbers from 1 to 40 can you make? Not all of the numbers are possible!

You may use each digit up to the number of times it appears in 2021, but not more. i.e., you can use 2 twice but the rest can be used once. You do not have to use every digit.

Also, you may concatenate (so you may make 12 by combining 1 and 2)

You don't need to use all the digits

$\endgroup$
7
  • $\begingroup$ There are two "2" digits listed in the title but the representative answer uses one or two, variously. Can you clarify what "exactly once" means to this puzzle? $\endgroup$
    – user662852
    Dec 16 '20 at 14:03
  • $\begingroup$ Please clarify "Exactly once" There are 2 twos. They both must be used? Like 22+1+0? $\endgroup$
    – DrD
    Dec 16 '20 at 14:05
  • $\begingroup$ It says to use the digits from "2021" once, How is not clear that the 2, the 0, the 2, and the 1 are all used once? $\endgroup$ Dec 16 '20 at 14:09
  • $\begingroup$ Digits in 2021 are 0,1 and 2 $\endgroup$
    – DrD
    Dec 16 '20 at 14:11
  • $\begingroup$ @DrD No, each number is a different digit. $\endgroup$ Dec 16 '20 at 15:16
9
$\begingroup$

Given OP's deleted answer it looks like concatenation is allowed and not all numbers must be used. Here are the numbers I was able to do (26/40)

$1 = 1$
$2 = 2$
$3 = 2 + 1$
$4 = 2 + 2$
$5 = 2 + 2 + 1$
$6 = (2+1) \times 2$
$7 = \frac{10}{2} + 2$
$8 = 10 - 2$
$9 = 10 - \frac{2}{2}$
$10 = 10$
$11 = 10 + \frac{2}{2}$
$12 = 12$
$14 = 10 + 2 + 2$
$16 = (10-2) \times 2$
$17 = 20 - 2 - 1$
$18 = 20 - 2$
$19 = 20 - 1$
$20 = 20$
$21 = 20 + 1$
$22 = 20 + 2$
$23 = 20 + 2 + 1$
$24 = 12 \times 2$
$32 = 20 + 12$
$38 = (20 - 1) \times 2$
$39 = (20 \times 2) - 1$
$40 = 20 \times 2$

$\endgroup$
5
$\begingroup$

Assuming

that "you can concatenate" means not only the individual digits, but also the results of their operations,

the available numbers are

0 to 12, 14 to 25, 28, 30, 32, 38, 39 and 40.

because of

the following Python script (sorry for such an awkward one!) which enumerate all possible binary trees with no more than 4 leaves and computes the result for expression denoted by each of the trees for all permutations of operators and operands (which are 2021 digits)

from itertools import permutations, groupby
from operator import itemgetter

# all permutations of 2021 digits
p = list(permutations([2, 0, 2, 1]))
# all operations
ops = [("+", lambda x, y: x + y), 
       ("-", lambda x, y: x - y), 
       ("*", lambda x, y: x * y),
       ("/", lambda x, y: x / y if  y != 0 else 1000000),
       ("|", lambda x, y: float(str(abs(int(x))) + str(abs(int(y)))))]

# set of values
v = set()

for x in p:
    # using 1 digit:
    v.add((f"{x[0]}", x[0]))
   # using 2 digits:
    for (s1, op1) in ops:
        v.add((f"{x[0]} {s1} {x[1]}", op1(x[0], x[1])))
    # using 3 digits:
    for (s1, op1) in ops:
        for (s2, op2) in ops:
            v.add((f"({x[0]} {s1} {x[1]}) {s2} {x[2]}", op2(op1(x[0], x[1]), x[2])))
            v.add((f"{x[0]} {s1} ({x[1]}) {s2} {x[2]})", op1(x[0], op2(x[1], x[2]))))
    # using 4 digits:
    for (s1, op1) in ops:
        for (s2, op2) in ops:
            for (s3, op3) in ops:
                v.add((f"({x[0]} {s1} {x[1]}) {s2} ({x[2]} {s3} {x[3]})", op2(op1(x[0], x[1]), op3(x[2], x[3]))))
                v.add((f"(({x[0]} {s1} {x[1]}) {s2} {x[2]}) {s3} {x[3]}", op3(op2(op1(x[0], x[1]), x[2]), x[3])))
                v.add((f"(({x[0]} {s1} ({x[1]} {s2} {x[2]})) {s3} {x[3]}", op3(op1(x[0], op2(x[1], x[2])), x[3])))
                
                v.add(( f"{x[0]} {s1} (({x[1]} {s2} ({x[2]}) {s3} {x[3]})", op1(x[0], op3(op2(x[1], x[2]), x[3]))))

results = list(r for r in v if 0 <= r[1] <= 40 and int(r[1]) == r[1])
results.sort(key=itemgetter(1))

abridged = [list(g)[0] for k, g in groupby(results, key=itemgetter(1))]

for s in abridged: print(s)
(Try it online!)

Note that all numbers not mentioned in hexomino's answer use concatenation of results (denoted here by $\#$):

$15= ((1 + 2) \# 0) / 2$
$25 = 2 \# (10 / 2)$
$28 = (1 + 2) \# 0 - 2$
$30 = (1 + 2) \# 0$

$\endgroup$
2
  • $\begingroup$ I think that your interpretation of "concatenate" isn't the intended one - I rewrote that bit from "also you can make numbers from the digits such 12" which seems to say that you can only concatenate the initial digits. $\endgroup$
    – bobble
    Dec 16 '20 at 17:53
  • $\begingroup$ @bobble At least, that makes hexomino's answer proven. $\endgroup$
    – trolley813
    Dec 16 '20 at 18:08
0
$\begingroup$

1 = 2 + 0 - 2 + 1
2 = (2 + 0) / 2 + 1
3 = 2^2 - 1 - 0
4 = 2^2 - 0/1
5 = 2 + 0 + 2 + 1
6 = (2 + 1)2 + 0
7 = 10/2 + 2
8 = (2 + 1)! + 2 - 0
9 = (2 + 1)^2 + 0/2
10 = (20/2) / 1
11 = 20 / 2 + 1
12 = 12 + 0/2
13 = 12 + (0/2)!
14 = 12 + 2 + 0
15 = C(10,2) / ( 2! + 0! )
16 = 2^ ( 0! + 1! + 2!)
17 = 20 - 2 -1
18 = 20 - (2/1)!
19 = 20 - 2! + 1!
20 = 20 / (2 -1)
21 = 20 + 2 - 1
22 = 20 + 2/1
23 = 20 + 2 + 1
24 = ( 12) ( 2 + 0)
25 = 122 + 0!
26 = 20 + (1 + 2)!
27 = (2 ! + 0! ) ^( 2 + 1)
28 = C(10-2, 2)
29 = [(2+0!)! / .2] -1
30 = (2 + 0!)! * (1/.2)
31 = 2^(1/.2) - 0!
32 = 10 + 22
33 = 2^(1/.2) + 0!
34 = (2^2)! + 10
35 = [ (2 + 1) 1] ^2 - 0!
36 = [ (2 + 1)! ] ^2 - 0
37 = 2! + 0!)! ^( 2) + 1
38 = (20-1) * 2
39 = 202 - 1
40 = 10 (2 + 2)
41 = 20 * 2 + 1
42 = 21
2 - 0
43 = 21 *2 + 0!
44 = 22(1 + 0!)
45 = p(10, 2)/2
46 = 10.2(bar)/0.2(bar)
47 = C(10,2) + 2
48 = (10/.2) - 2
49 =((2+1)! + 0!)^2
50 = 10^2/2
51 = 102/2
52 = (10/.2) + 2
53 = ( 12/.2 bar) - 0!
54 = ( 12/.2 bar) + 0
55 = (12 - 0!)/.2
56 = P(10-2,2)
57 =
58 =[ ( 2 + 0! )! / .1] - 2
59 = 12/.2 - 0!
60 = 20 ( 2 + 1)
61 = 12/.2 + 0!
62 = [( 2 + 0! )!/ .1] + 2
63 = 2^( [ 2 + 1]!) - 0!
64 = 2^([2 + 1)! ] + 0
65 = C(12,2) - 0!
66 = C(12,2) - 0
67 = C(12,2) + 0!
68 =
69 =
70 =
71 =
72 = (12) ( 2 + 0!)!
73 =
74 =
75 =
76 =
77 =
78 = C(12+0!, 2)
79 = [( 0! / .1 bar ) ^2] -2
80 = [2^( 2 + 0!)] / .1
81 =[( 2^0/.1 bar)^2]
82 =
83 = [ (0!/.1 bar)^2] +2
84 =
85 =
86 =
87 =
88 = P(10,2) - 2
89 = (20/.2 bar) - 1
90 = C(10,2) * 2
91 = ( 20/.2 bar) + 1
92 = P (10,2) +2
93 =
94 =
95 = (20 -1)/.2
96 =
97 =
98 = 10^2 - 2
99 = 20/.2 - 1
100 = 102 - 2

$\endgroup$
2
  • 2
    $\begingroup$ The question is only 1-40, you don't need to go all the way up to 100. Also, you should hide your answer in a spoiler tag >!, so as not to spoil the solution for anyone who wants to have a go at the puzzle themselves. $\endgroup$
    – F1Krazy
    Jan 13 at 17:01
  • $\begingroup$ 25 does not fit $\endgroup$
    – Marius
    Apr 20 at 6:48
0
$\begingroup$

I tried to make the numbers using all the digits
I got 25 of them using all digits and 1 using only 3 digits

$1 = \frac{2}{2} \times 1 + 0$
$2 = 2 \times 1 + 2 \times 0$
$3 = 2 + 1 + 2 \times 0$
$4 = 2 + 2 \times 1 + 0$
$5 = 2 + 2 + 1 + 0$
$6 = 2 \times (2+1) + 0$
$7 = \frac{10}{2} + 2$
$8 = 20 - 12$
$9 = 10 - \frac{2}{2}$
$10 = 12 - 2 - 0$
$11 = 10 + \frac{2}{2}$
$12 = 12 + 2 \times 0$
$13 = $
$14 = 10 + 2 + 2$
$15 = $
$16 = (10 - 2) \times 2$
$17 = 20 - 2 - 1$
$18 = 20 - 2\times 1$
$19 = 20 - 2 +1 $
$20 = 10 \times 2$ //missing a 2
$21 = 20 + 2 - 1 $
$22 = 22 - 0 \times 1 $
$23 = 20 + 2 + 1 $
$24 = 12 \times 2 + 0 $
$25 = $
$26 = $
$27 = $
$28 = $
$29 = $
$30 = $
$31 = $
$32 = 22 + 10 $
$33 = $
$34 = $
$35 = $
$36 = $
$37 = $
$38 = (20 - 1) \times 2$
$39 = 20 \times 2 - 1$
$40 = (2+2) \times 10 $

$\endgroup$
0
$\begingroup$

I see one solution for 13 in the above answers using factorials, but if exponentiation is allowed, we can also do:

13 = 12 + 2^0

The answer from MATIUS using factorials and C(n,r) function has a solution for 15 using C(n,r) but here is one with only factorial:

15 = 12 + 2 + 0!

Alternate solutions for 26 and 27 using factorials:

26 = 2*(12 + 0!)
26 = (2+2)! + 0! + 1
27 = 21 + (2+0!)!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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