# Sticky sticky stick stick

You are given a long enough stick. Your task is to create a new type of foldable ruler something like shown below with it by cutting the stick into pieces and folding them at one point:

You need to have something like above but no mark on it and all sticks are attached at one point and they do not have to have same lengths. You may think each stick as a line and they are sticked at one point for simplicity but it is still foldable so you can measure lengths by folding the rulers. Then By folding the ruler, you are supposed to measure every cm from 1 to 40.

What is the shortest stick length originally you need to have to measure every cm from $1$ to $40$ for this foldable ruler?

For example: if this question was asked for 1 to 8 cm, the answer would be $9$ cm with 1,2,6 cm sticks. So you can measure every cm from 1 to 8 by folding the ruler, such as to measure $8$, fold 2 cm stick to the one side while 6 cm stick to the other side, or to measure $4$ you can fold 2 and 6 in the same side, etc...

I think

.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 19.5, 33.5

This gives a total of

77.5

As far as I can tell, this seems to yield all the integers between 1 and 40.

Thanks to Jonathan Allan for

stopping me from trying to shave off the .5 :)

• Ahha of course (I kept trying adjusting by too much :p) – Jonathan Allan Aug 27 '18 at 21:42
• @JonathanAllan Haha I was pretty sure that your solution was the best, but then this suddenly hit me. – 1848 Aug 27 '18 at 21:45
• FWIW according to an integer linear program for the problem, this solution seems to be best possible (of the form considered). – Neal Young Aug 28 '18 at 2:27
• great! you got it, i hope you like its trickiness. – Oray Aug 28 '18 at 4:05
• @Oray really fun problem; keep it up! – 1848 Aug 28 '18 at 5:56

Continuing with a similar pattern as above,

We can include $n$ stick lengths from 1 to $n$, and then select one stick length of length $40-n$. At the very least, this will provide an upper bound.

You can create

1-10 using exactly those sticks; 11-19 using 10 + (1 through 9); 20-29 using 30 - (1 through 10); 30 using exactly that stick; and 31-40 using 30 + (1 through 10).

This means we need a total stick length of

1+2+3+4+5+6+7+8+9+10+30 = 85 cm.

This may not yet be isn't quite the best...

But it does it in 79cm:
1, 2, 3, 4, 5, 6, 7, 18, 33

• getting close :) – Oray Aug 27 '18 at 21:05
• FWIW this seems to be best possible with integer lengths. – Neal Young Aug 28 '18 at 2:26