In [1]:
import re
text = ''
m1 = ['+', '-', '*', '/', ' ']
for i in range(2, 10):
    for j in '+-*/ ':
        m1.append(f'**(1/{i}){j}')
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:
                        print(f'{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+3**(1/2)*3**(1/2) = 6
3*3-3 = 6
3**(1/2)*3**(1/2)+3 = 6
4+4-4**(1/2) = 6
4+4/4**(1/2) = 6
4+4**(1/3)*4**(1/6) = 6
4+4**(1/4)*4**(1/4) = 6
4+4**(1/6)*4**(1/3) = 6
4-4**(1/2)+4 = 6
4*4**(1/2)-4**(1/2) = 6
4/4**(1/2)+4 = 6
4**(1/2)+4**(1/2)+4**(1/2) = 6
4**(1/2)+4**(1/2)*4**(1/2) = 6
4**(1/2)*4-4**(1/2) = 6
4**(1/2)*4**(1/2)+4**(1/2) = 6
4**(1/3)*4**(1/6)+4 = 6
4**(1/4)*4**(1/4)+4 = 6
4**(1/6)*4**(1/3)+4 = 6
5+5/5 = 6
5+5**(1/2)/5**(1/2) = 6
5+5**(1/3)/5**(1/3) = 6
5+5**(1/4)/5**(1/4) = 6
5+5**(1/5)/5**(1/5) = 6
5+5**(1/6)/5**(1/6) = 6
5+5**(1/7)/5**(1/7) = 6
5+5**(1/8)/5**(1/8) = 6
5+5**(1/9)/5**(1/9) = 6
5/5+5 = 6
5**(1/2)/5**(1/2)+5 = 6
5**(1/3)/5**(1/3)+5 = 6
5**(1/4)/5**(1/4)+5 = 6
5**(1/5)/5**(1/5)+5 = 6
5**(1/6)/5**(1/6)+5 = 6
5**(1/7)/5**(1/7)+5 = 6
5**(1/8)/5**(1/8)+5 = 6
5**(1/9)/5**(1/9)+5 = 6
6+6-6 = 6
6+6**(1/3)-6**(1/3) = 6
6+6**(1/4)-6**(1/4) = 6
6+6**(1/5)-6**(1/5) = 6
6+6**(1/6)-6**(1/6) = 6
6+6**(1/7)-6**(1/7) = 6
6+6**(1/8)-6**(1/8) = 6
6+6**(1/9)-6**(1/9) = 6
6-6+6 = 6
6-6**(1/2)+6**(1/2) = 6
6-6**(1/3)+6**(1/3) = 6
6-6**(1/4)+6**(1/4) = 6
6-6**(1/5)+6**(1/5) = 6
6-6**(1/6)+6**(1/6) = 6
6-6**(1/7)+6**(1/7) = 6
6-6**(1/8)+6**(1/8) = 6
6-6**(1/9)+6**(1/9) = 6
6*6/6 = 6
6*6**(1/2)/6**(1/2) = 6
6*6**(1/3)/6**(1/3) = 6
6*6**(1/6)/6**(1/6) = 6
6*6**(1/7)/6**(1/7) = 6
6*6**(1/8)/6**(1/8) = 6
6*6**(1/9)/6**(1/9) = 6
6/6*6 = 6
6/6**(1/2)*6**(1/2) = 6
6/6**(1/3)*6**(1/3) = 6
6/6**(1/4)*6**(1/4) = 6
6/6**(1/5)*6**(1/5) = 6
6/6**(1/6)*6**(1/6) = 6
6/6**(1/7)*6**(1/7) = 6
6/6**(1/8)*6**(1/8) = 6
6/6**(1/9)*6**(1/9) = 6
6**(1/2)-6**(1/2)+6 = 6
6**(1/2)*6/6**(1/2) = 6
6**(1/2)/6**(1/2)*6 = 6
6**(1/3)+6-6**(1/3) = 6
6**(1/3)-6**(1/3)+6 = 6
6**(1/3)*6/6**(1/3) = 6
6**(1/3)*6**(1/3)*6**(1/3) = 6
6**(1/3)*6**(1/6)*6**(1/2) = 6
6**(1/3)/6**(1/3)*6 = 6
6**(1/4)+6-6**(1/4) = 6
6**(1/4)-6**(1/4)+6 = 6
6**(1/4)*6**(1/4)*6**(1/2) = 6
6**(1/4)/6**(1/4)*6 = 6
6**(1/5)+6-6**(1/5) = 6
6**(1/5)-6**(1/5)+6 = 6
6**(1/5)/6**(1/5)*6 = 6
6**(1/6)+6-6**(1/6) = 6
6**(1/6)-6**(1/6)+6 = 6
6**(1/6)*6/6**(1/6) = 6
6**(1/6)*6**(1/3)*6**(1/2) = 6
6**(1/6)/6**(1/6)*6 = 6
6**(1/7)+6-6**(1/7) = 6
6**(1/7)-6**(1/7)+6 = 6
6**(1/7)*6/6**(1/7) = 6
6**(1/7)/6**(1/7)*6 = 6
6**(1/8)+6-6**(1/8) = 6
6**(1/8)-6**(1/8)+6 = 6
6**(1/8)*6/6**(1/8) = 6
6**(1/8)/6**(1/8)*6 = 6
6**(1/9)+6-6**(1/9) = 6
6**(1/9)-6**(1/9)+6 = 6
6**(1/9)*6/6**(1/9) = 6
6**(1/9)/6**(1/9)*6 = 6
7-7/7 = 6
7-7**(1/2)/7**(1/2) = 6
7-7**(1/3)/7**(1/3) = 6
7-7**(1/4)/7**(1/4) = 6
7-7**(1/5)/7**(1/5) = 6
7-7**(1/6)/7**(1/6) = 6
7-7**(1/7)/7**(1/7) = 6
7-7**(1/8)/7**(1/8) = 6
7-7**(1/9)/7**(1/9) = 6
8-8**(1/2)/8**(1/6) = 6
8-8**(1/6)*8**(1/6) = 6
8/8**(1/3)+8**(1/3) = 6
8**(1/2)*8**(1/6)+8**(1/3) = 6
8**(1/3)+8/8**(1/3) = 6
8**(1/3)+8**(1/2)*8**(1/6) = 6
8**(1/3)+8**(1/3)+8**(1/3) = 6
8**(1/3)+8**(1/3)*8**(1/3) = 6
8**(1/3)+8**(1/6)*8**(1/2) = 6
8**(1/3)*8**(1/3)+8**(1/3) = 6
8**(1/6)*8**(1/2)+8**(1/3) = 6
9-9/9**(1/2) = 6
9-9**(1/3)*9**(1/6) = 6
9-9**(1/4)*9**(1/4) = 6
9-9**(1/6)*9**(1/3) = 6
9/9**(1/2)+9**(1/2) = 6
9**(1/2)+9/9**(1/2) = 6
9**(1/2)+9**(1/3)*9**(1/6) = 6
9**(1/2)+9**(1/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