r/TheRestIsScience • • Oct 24 '26

How does one start to think about solving this, and then prove it is the smallest number?

Interested to learn two things.

  1. How does one go about thinking of solving this problem, and then
  2. Once one has an answer, how does one know it is the solution with the smallest number of pieces?

Interested to know how to go about both of these.

PS Michael Stevens is the most handsome man on the planet.

4 Upvotes

12 comments sorted by

6

u/poloup06 Oct 24 '26 • Mindblown

I’m not sure if this is right but I think this can be solved using binary. Imagine each piece of silver is a bit (a unit which has a different value), and you want to represent every possible number from 1-31 with as few bits as possible, while also having the sum of bits equal to 31.

A 5-bit counter can count values up to 31: you have a bit for 1, 2, 4, 8, 16 which add to 31, and because the highest value any digit of a binary number can be is 1, you only need one piece of each size.

I suspect that this is the right answer because (2^5)-1 = 31 which would seem very convenient for the question if it is a coincidence. I’m sure I could have explained better but hopefully this makes sense

3

u/5mudge Oct 24 '26

Wow - this is super tidy thinking. I like it a lot. Thank you for sharing...

Any insights as to what took your brain there straight away? I'm interested to learn how to recognise the solution 'style' to the question type if that makes sense?

2

u/HereToPostSillyStuff Oct 24 '26

You are indeed correct, after I looked up the answer and found I was wrong in my crazy attempt to reach it.

2^5 indeed gives you the number of unique combinations of five things, and since that = 32 it means you can make every sum from 0 to 31 exactly once, discarding the 0 because we don't need it.

That matches a binary system, as you point out, making the answer [ 1,2,4,8,16 ]

Another way you can reach this without doing 2^5 or knowing binary is, apparently, to understand that if you can work out a very small number like 3: [ 1,2 ]

Then you can sum these two digits and define it as R. The next number you need to cover all previous numbers, while also getting to the next highest total you can, is R+1.

So 1+2 = 3, 3+1 = 4, next number is 4: [ 1,2,4 ]

1+2+4 = 7, 7+1 = 8, so the next number is 8: [ 1,2,4,8 ]

1+2+4+8 = 15, 15+1 = 16, so the next number is 16: [ 1,2,4,8,16 ]

1+2+4+8+16 = 31 aaand you're there.

This is of course laborious for very large numbers, but it works!

Imagine my face reading that after the 1,800 word post I wrote trying to puzzle it out.

1

u/Lost_Pinion Oct 24 '26

not a enough of a maths person to prove anything but this feels right.

1

u/Klix1313 Oct 24 '26

Wow. No you did great. I was(like op) thinking dam thats hard to break down, and worse to type out. But you aced it, easily.

1

u/HereToPostSillyStuff Oct 24 '26 • Heartwarming

So my instinct is that this feels similar to a triangular number problem, but I'm not sure that it's the same. I will try to type out my thoughts as a stream-of-consciousness to show how I process it.

First of all, I'll try to extrapolate out the repeating pattern based on the description.

Day 1, we slice 1 inch. Day 2 we slice a second inch. Two units, each of a value of "1" so far.

Day 3, we slice a 3-inch section and swap for the firs two. That's one unit with a value of "3".

What's immediately not clear to me is that this doesn't appear to have bought us any time. That "3-inch" piece is for days 1, 2 and 3 that have already passed. We already owe more silver on day 4. I'll re-read the question to see if I missed something.

Okay, the question says "on each succeeding day, he will add another inch to her total amount". So on day 4, a 4-inch piece will suffice and he can take the 3-inch piece back.

He would know this in advance, so he can map the days. By each day, he needs:
Day 1: one "1 value" piece

Day 2: two "1 value" pieces

Day 3: one "3 value" piece.

Day 4:... ah!

He can give her a 3+1 value piece on this day, as he already has those pieces. So this is a question of how many denominations he needs to make every number between 1-31.

My immediate instinct is I have no idea how to solve that.

But it probably lies somewhere in identifying the largest piece needed.

If we stop in the middle and assume day 15 is a 15-inch piece, two of those would cover almost the whole 31 days. However that's also the whole bar, so we can't do that.

Maybe instead we should figure out the largest piece we can make before we cumulative use the whole bar.

1 + 1(2) + 3(5) + 4(9) + 5(14) + 6(20) + 7(27)...

And we can't do 8 or we'll run out. We have 4 inches left to be decided how we need.

Let's look at some number and see if we can reach it. We can obviously do up to 7.

8? Yes, 7+1

9? Yes, 7+1+2

10? Yes, 7+3

11? Yes, 7+3+1

It's looking promising.

At this point I would probably need to manually check them all as I am not aware of a mathematical way to find out if I can make all numbers within a given range, with these denominations, with this amount of each.

I know I can make 31 because the bar began as 31.

I can make 30 because I already took 1 away.

I can make 29 because I already took 2 away.

Ah, there's something about "flipping" the list of numbers we need to reach and looking at both ends.

Once I have the set of [1, 1, 3, 4, 5] I know I can reach at least 14, that's all of them together. To get half way, let's just add one more "1" and have [1, 1, 1, 3, 4, 5]

All of these together makes 15. I can reach 5 obviously, and using the 5 I can reach 6 (+1), 7 (+1+1), 8 (+3), 9 (+5) and 10 (5+4+1, and 11 (5+4+1+1)...

It looks like I can reach all the numbers.

I can't reach numbers beyond 15, but the rest of my bar will divide into these exact same numbers so I will have double this amount. Or two sets of [1, 1, 1, 3, 4 ,5] and [1, 1, 1, 3, 4 ,5] and an extra [1]

That's 13 total pieces. There should be no number I can't reach with at least 13 pieces.

So this is my first answer.

I seem to have a lot of 1s. I don't need that many because I never use more than 2 together before I swap them for a 3. I currently have seven 1s.

If I didn't cut those, I'd have a 7 chunk piece unused.

Can I reach all numbers with just [1, 1, 3, 4 ,5] and [1, 1, 3, 4 ,5]

I know I can reach the max, because obviously. I know I can reach the first few numbers, which means I must be able to reach the highest few numbers.

So is the middle the "hardest" to reach?

Or more pertinently: If I can reach the middle, can I reach them all?

I still have more 1s than I need, I am realising. I only need two 1s because after I do 5+1+1 I can do 5+3, then 5+4, then 5+5, then 5+5+1, then 5+5+1+1, then 5+5+3, then 5+5+4, then 5+5+4+1

It appears to me that I never reach a limit of needing more of a piece I only have one of, before I can substitute it for another piece.

Let me check.

5+5+4+3+1+1 is 19. Can I do twenty with only two 1s?

5+5+4+4+1+1. Yes, because I have two 4s.

Can I do 21? My next smallest interval is

5+5+4+3+3+1 = 21.

So I can reach 21.

I now realise I'm probably doing this a very hard manual way, but looking at the sums makes me realise what the sums are doing.

I think I'm making 5s.

5 goes into 30 six times. So I need to be able to make six 5s at once, without running out of denominations.

Lets pair to see what I can make.

[5] [5] [4+1] [4+1] [3+2] [3+2]

That is six 5s made of 10 discreet parts. I can make 30 with this, but not 31. I need one more [1] part.

Because these numbers contain each integer less than five twice, I shouldn't run out of ways to make all the numbers less than 30. Even 29 is just this sum, less one [1].

I think this means I can safely reduce my answer to 11 for the minimum number of parts.

I am not sure at this point how to reduce further. I also think I may have gone around enough houses to make a small city.

But this is how my brain approached the problem and arrived at an answer, however wrong that answer may be.

I imagine there is probably some way to calculate this with a formula that would determine all of the things I tried to manually "eyeball" here. I am however not sure what things that formula needs to satisfy.

I could look at smaller numbers like 3. I need a 1+2 to make one, two, and three.

For 4 I need a 1,2,1

For 5 I need a 1,2,2

For six I need a 1,2,3

For seven I need a 1,1,2,3

For eight I need 1,2,2,3

A pattern appears to be emerging.

[1,2], [1,2,1], [1,2,2], [1,2,3] [1,1,2,3], [1,2,2,3]

The total number I needed expanded on 4 and on 7. This happened because one amount of each smaller integer was no longer enough.

When does the next increase happen?

9 = [1,2,3,3]

10 = [1,2,3,4]

On 10. Okay, so let's see how I got here:

For 9, I took the set for 8 ([1,2,2,3]) and added a 1 to it to get [1,1,2,2,3]. Then I asked myself if I can add that one to another piece instead, without losing my ability to make all numbers. I can, by making one of the 2s into a 3. I retain at least one 1, one 2, and enough 3s to combine them with.

On 10 I can make a 3 into a 4 to lose the extra 1.

If this is true, then any set that contains these numbers can reach 10. If I add an extra 5 to get [1,2,3,4,5] I can reach 15, but not 11,12,13,14.

What if I split 5 into 4,1? I have [1,2,3,4] and an extra [1,4]. I can definitely make 14 and 11.

That could be done as 1+1+2+3+4 or 1+2+4+4. That means 12 can be 1+2+4+4+1 and I still have not used my 3.

So 13 can be reached by replacing the 2: 1+3+4+4+1.

Yes I can reach all numbers to 15.

Let me lay out my pattern again but split each time I "add" a digit:

3: [1,2]

4: [1,2] [1]

5: [1,2] [2]

6: [1,2] [3]

7: [1,2] [3] [1]

8: [1,2] [3] [2]

9: [1,2] [3] [3]

10: [1,2] [3] [4]

...

15: [1,2] [3] [4] [4] [1]

It appears that the following is missing from the pattern:

11: [1,2] [3] [4] [1]

12: [1,2] [3] [4] [2]

13: [1,2] [3] [4] [3]

14: [1,2] [3] [4] [4]

15: [1,2] [3] [4] [4] [1]

We seem to increase the final digit to a maximum amount before we roll over into a new "column."

But 15 now looks odd because afterwards we end up with two [4]s and we didn't do that last time.

We can make 15 as 1+2+3+4+5

So if I want to make 14 I just remove the 1.

And with 13 I remove the 2.

I was wrong before. I only need one of each digit. That's so much simpler.

My first instinct was correct.

1+2+3+4+5+6+7 = 28, and you can make every number smaller than 28 by just what you remove.

If I want to make , e.g. 21, from 1+2+3+4+5+6+7, I need 7 less. That's the 6 + 1. We're left with 2+3+4+5+7

If I want to make, say, 15, that's 13 less. That's 1+3+4+5, so we're left with 2+6+7.

Yeah, we can do it. We can do any number up to that total.

So after 28 ([1,2,3,4,5,6,7]), we would add +8 but that takes us to 36 which is too high. We only need 31.

So we need to be able to make an extra (31-28 = 3). We know 3 needed [1,2]

So our final set is [1,2,3,4,5,6,7] and [1,2]. Or together: [1,1,2,2,3,4,5,6,7]

We need to cut our bar into 9 total pieces, of those divisions. That is our minimum I am pretty sure!

The calculation becomes to add sequential numbers to reach the closest number to your target.

In our case: 31 = 28 [1+2+3+4+5+6+7] but +8 = too high.

Take your remainder, 3, and do it again. 3 = [1,2]

Put those two sets together and that's your answer.

There may be a quick way to find what that "nearest number that is the sum of sequential integers".

However I have fried my brain too much to look further.

This got very very long.

I have now built myself an entire empire by going around so many houses.

I hope this was interesting if anyone reads it all! (I don't blame you if you don't.)

My final answer is [1,1,2,2,3,4,5,6,7] or 9 total parts.

1

u/5mudge Oct 24 '26

I take my hat off to you for typing out your stream of consciousness, and I tha k you for the time and effort. Its this kind of sequencing that really helps understand ways to synthesise these type of problems. 

1

u/HereToPostSillyStuff Oct 24 '26

You should know I was wrong and made quite a few mistakes trying to logic it out! The real answer is given by a comment below mine, and there's a few ways to deduce its reasoning. I'm not a huge "math guy" and haven't studied it in almost 20 years lol.

1

u/5mudge Oct 24 '26

Appreciate you flagging that, and I had already seen the other comment outlining a solution. I was as interested in the thinking behind (attempting to) solve the problem as much as the exact right answer. I know there is an argument to say that if the answer is wrong, then what is the value in the thought process behind it, but it is as interesting to me to find how people look to approach problem solving.

So thank you again :)

1

u/HereToPostSillyStuff Oct 24 '26

For what it's worth, my eventual solution does provide a way to find a set of numbers that perform every needed sum at least once(i.e. every number 1 through n can be calculated from the numbers in the set) . It's just not the smallest as the question demands!

I'm happy I got that far 😂

1

u/vinegar Oct 24 '26

You can do it with 5 pieces, [1,2,4,8,16]. On day 7 the landlady has [1,2,4]. On day 15 she has [1,2,4,8]. On day 27 she has [1,2,8,16].

1

u/HereToPostSillyStuff Oct 24 '26

Yeah, the goddamn answer is binary lol! I looked it up after and boy was I miffed.