題目

只能用運算符號完成下列等式

2 2 2 = 6

3 3 3 = 6

4 4 4 = 6

5 5 5 = 6

6 6 6 = 6

7 7 7 = 6

8 8 8 = 6

9 9 9 = 6

In [1]:
import re
text = ''
m1 = ['+', '-', '*', '/', ' ']
for i in range(2, 10):
    for j in '+-*/ ':
        m1.append(f'**(1/{i}){j}')
n = 0
for i in '23456789':
    for j in m1:
        for k in m1:
            for l in m1:
                try:
                    t = f'{i}{j}{i}{k}{i}{l}'
                    if eval(t) == 6:
                        n += 1
                        print(f'{n}, {t}= 6')
                        text += re.sub(r"(?P<word1>\d+)\*\*\(1/(?P<word2>\d+)\)", '\\\\sqrt[\g<word2>]{\g<word1>}', f'{t}= 6\\\\\n').replace('*', '×').replace('/', '÷').replace('\sqrt[2]', '\sqrt')
                except:
                    pass
text = f'$${text[:-3]}$$'
$$2+2+2 = 6\\ 2+2×2 = 6\\ 2×2+2 = 6\\ 3+\sqrt{3}×\sqrt{3} = 6\\ 3×3-3 = 6\\ \sqrt{3}×\sqrt{3}+3 = 6\\ 4+4-\sqrt{4} = 6\\ 4+4÷\sqrt{4} = 6\\ 4+\sqrt[3]{4}×\sqrt[6]{4} = 6\\ 4+\sqrt[4]{4}×\sqrt[4]{4} = 6\\ 4+\sqrt[6]{4}×\sqrt[3]{4} = 6\\ 4-\sqrt{4}+4 = 6\\ 4×\sqrt{4}-\sqrt{4} = 6\\ 4÷\sqrt{4}+4 = 6\\ \sqrt{4}+\sqrt{4}+\sqrt{4} = 6\\ \sqrt{4}+\sqrt{4}×\sqrt{4} = 6\\ \sqrt{4}×4-\sqrt{4} = 6\\ \sqrt{4}×\sqrt{4}+\sqrt{4} = 6\\ \sqrt[3]{4}×\sqrt[6]{4}+4 = 6\\ \sqrt[4]{4}×\sqrt[4]{4}+4 = 6\\ \sqrt[6]{4}×\sqrt[3]{4}+4 = 6\\ 5+5÷5 = 6\\ 5+\sqrt{5}÷\sqrt{5} = 6\\ 5+\sqrt[3]{5}÷\sqrt[3]{5} =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6\\ \sqrt[3]{8}+\sqrt[6]{8}×\sqrt{8} = 6\\ \sqrt[3]{8}×\sqrt[3]{8}+\sqrt[3]{8} = 6\\ \sqrt[6]{8}×\sqrt{8}+\sqrt[3]{8} = 6\\ 9-9÷\sqrt{9} = 6\\ 9-\sqrt[3]{9}×\sqrt[6]{9} = 6\\ 9-\sqrt[4]{9}×\sqrt[4]{9} = 6\\ 9-\sqrt[6]{9}×\sqrt[3]{9} = 6\\ 9÷\sqrt{9}+\sqrt{9} = 6\\ \sqrt{9}+9÷\sqrt{9} = 6\\ \sqrt{9}+\sqrt[3]{9}×\sqrt[6]{9} = 6\\ \sqrt{9}+\sqrt[4]{9}×\sqrt[4]{9} = 6\\ \sqrt{9}+\sqrt[6]{9}×\sqrt[3]{9} = 6\\ \sqrt{9}×\sqrt{9}-\sqrt{9} = 6\\ \sqrt[3]{9}×\sqrt[6]{9}+\sqrt{9} = 6\\ \sqrt[4]{9}×\sqrt[4]{9}+\sqrt{9} = 6\\ \sqrt[6]{9}×\sqrt[3]{9}+\sqrt{9} = 6$$

題目

只能用運算符號完成下列等式

3 3 3 = 1

3 3 3 = 2

3 3 3 = 3

3 3 3 = 4

3 3 3 = 5

3 3 3 = 6

3 3 3 = 7

3 3 3 = 8

3 3 3 = 9

3 3 3 = 10

In [2]:
import re
text = ''
m1 = ['+', '-', '*', '/', ' ', '**0']
for i in range(2, 10):
    for j in '+-*/ ':
        m1.append(f'**(1/{i}){j}')
for i in range(1, 11):
    for j in m1:
        for k in m1:
            for l in m1:
                try:
                    t = f'3{j}3{k}3{l}'
                    if eval(t) == i:
                        print(f'{t}= {i}')
                        text += re.sub(r"(?P<word1>\d+)\*\*\(1/(?P<word2>\d+)\)", '\\\\sqrt[\g<word2>]{\g<word1>}', f'{t}= {i}\\\\\n').replace('*', '×').replace('/', '÷').replace('\sqrt[2]', '\sqrt').replace('××', '^')
                except:
                    pass
text = f'$${text[:-3]}$$'
$$3-3+3^0= 1\\ 3÷3×3^0= 1\\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