# Some interesting calculation puzzle that I made

So I'm creating some kind math puzzle that goes like this:

1=-2+3

12=3*4

123=(4*5)+(6+7)*8-9+10 (thanks JS1 for finding shorter one)

1234=(5*6*7*8)-(9+10+11+12+13+14+15+16+(17*18)+19+20+(-21+22))

...and so on. So how long (or what is the shortest possible) that kind of equation to get 12345, 123456, 1234567, 12345678 or even 123456789?

• welcome to puzzling.se! sorry but what kind of operators are allowed? square root? factorials? thanks +1 and happy puzzling :) – Omega Krypton Jul 9 at 8:53
• 123=(4*5)+(6+7)*8-9+10, which is shorter than the one in the question. I don't dare try for 123456789 without a computer program though. – JS1 Jul 9 at 8:58
• Maybe we should add no-computers :) @JS1 – TheSimpliFire Jul 9 at 8:59
• I would suggest formalizing which operators are allowed, and also asking for the shortest way to form each number from 123 up to 123456789. It will give people something to work on. – JS1 Jul 9 at 9:15
• should it start with 10? as the examples in the question always start with +1 of the digit amount – Emre Ünsal Jul 9 at 9:17

12345 (largest integer 13)

12345 = 6+7+8+(((9*10)-11)*12*13)

123456 (largest integer 16)

123456 = (7+8-9+(10+((11+12+13)*14))*15)*16

1234567 (largest integer 17)

1234567 = 8*9*((10*11*12*13)-(14+15-16))-17

12345678 (largest integer 24)

12345678 = ((9+10)*((11+12+13)*14+(15*16*17))+18+(19*20*21*22))*(23+24)

123456789 (largest integer 27)

123456789 = (((10+((11+12)*13)+(14*(15+16)))*17*18+19+20)*21-((22+23)*24*25))*26+27

Bonus
123 (largest integer 9)

123 = 4+5+(6*7)+(8*9)

1234 (largest integer 12)

1234 = -5+(6-7+8)*(9*(10+11)-12)

My solution, may not be optimal

12345:

$$6*7*8*9+10*11*12+13*14*15+16*17*18+19*20+21+22-23-24+25-26$$

Done with largest integer $$60$$

We have $$10\times11\times\cdots\times15\times(16+17)=118918800$$ Deficit: $$4537989$$ $$18\times19\times20\times21\times(22+23)=6463800$$ Excess: $$1925811$$ $$(24+25+26)\times27\times28\times29=1644300$$ Deficit: $$281511$$ $$(30+31+\cdots+35)\times36\times37=259740$$ Deficit: $$21771$$ $$-38\times39\times40+41\times42\times43=14766$$ Deficit: $$7005$$ $$(44+45+46)\times47=6345$$ Deficit: $$660$$ $$-(48+49)\times50+(51+52)\times53=609$$ Deficit: $$51$$ $$54+55-56+57-58+59-60=51$$ Bingo.

Largest 38, but could be better

(((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)
=123456789

123456789 with 38 as the highest integer, but I used the division operator once (since OP didn't list available operators):

(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 = 123456789

Again, it's likely not the optimal solutions (for still unanswered numbers 123456, 1234567, 12345678):

123456 = 7*8*9*10*(11+12)+13*14*(15+16)+(17+18)*(19+20)+21+22*23-24+25-26+27
1234567 = 8*9*10*11*12*13-14*(15+16)-17*(18+19)+20+21+22+23+24
12345678 = 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