Hello, kids, we're going to solve a simple math task today!One has a full inventory and is standing on top of N (N<53) unknown books. What's the minimal number of turns one needs to read all the books and keep the initial inventory? As always, picking any number of items costs one turn and dropping costs one turn per item dropped. Version is 0.18, before this was implemented (hooray!).

Edit:All books are different. Reading a book takes 0 turns.

Last edited by Yermak on Wednesday, 15th June 2016, 08:50, edited 1 time in total.

If you spot a grammar mistake in my post I will appreciate if you PM it.

Here are my thoughts. Let r_1 + r_2 +...+ r_k = N, and suppose r_1 < r_2 <...< r_k. Then, subject to the assumption that you never want to drop an item that is not a book when you could drop a book instead, the minimal number of turns would be (r_1+1) +...+ (r_k+1) + r_k + 1, which is N + k + r_k + 1. So you want to minimize k + r_k. This looks like it should give ceil(2 * sqrt(N)).

Ok, in my original post you partition the set of books into k subsets, we use r_1,...,r_k to denote the size of the subsets. We assume that the r values are in ascending order of size. Then in the first turn you drop r_1 objects then pick up r_1 books, in the 2nd turn you drop r_2 objects (including all the books from turn 1) then pick up a new r_2 books. You keep doing this till you've picked up all the books. This takes (r_1+1)+...+(r_k+1) turns. But you still have to drop the last load of books and pick up your original stuff, so you add an extra r_k +1. Since r_1+...+r_k = N this simplifies to N + r_k + k + 1, and this will be minimized when r_k + k is minimal. I think but haven't proved that minimizing this will give 2*sqrt(N) rounded up.

Yermak wrote:Hello, kids, we're going to solve a simple math task today!One has a full inventory and is standing on top of N (N<53) unknown books. What's the minimal number of turns one needs to read all the books and keep the initial inventory? As always, picking any number of items costs one turn and dropping costs one turn per item dropped. Version is 0.18, before this was implemented (hooray!).

Hands wrote:Ok, in my original post you partition the set of books into k subsets, we use r_1,...,r_k to denote the size of the subsets. We assume that the r values are in ascending order of size....Since r_1+...+r_k = N this simplifies to N + r_k + k + 1, and this will be minimized when r_k + k is minimal. I think but haven't proved that minimizing this will give 2*sqrt(N) rounded up.

Sandman25 wrote:I see, we are trying to combine dropping books and dropping items to make room for more books.

Two problems with that:- There's no advantage to combining dropping items and books. Maybe you meant picking up?- In the case of an even number of books it's also not necessary to combine them.

The reason why this problem was (at least to me) a bit counter-intuitive is this: At first it seemed that maximising the number of items picked up in one go is the right strategy, because you get to pick up stuff 'for free'. But on examination the 'rate determining' step is dropping items and the fastest solutions balance time spent dropping items with picking up stacks of items. The total time spent dropping books is fixed, but the time spent dropping non-book items can be varied.

Imagine you have 30 books and split them in two stacks. Now you drop 15 items, then process the books, in two stacks, then pick up the 15 items. You saved dropping 15 items (15 turns), at the cost of spending 2 turns picking up 15 books. Total overhead: 17 (drop 15 items + 2 turns picking up books)Now imagine you split your books into 3 equal stacks of 10. Drop 10 items, process the books, pick up 10 items. You saved dropping 20 items (20 turns) at the cost of spending 3 turns picking up two stacks of 10 books. Total overhead: 13 (drop 10 items + 3 turns picking up books)Split books into 5 stacks of 6 books. Drop 6 items, process books, pick up 6 items. Saved dropping 24 items (24 turns) at the cost of spending 5 turns picking up 5 stacks. Total overhead: 11 (drop 6 items + 5 turns picking up stacks of books)The minimum is where the sum of turns spent dropping inventory items and turns spent picking up books is the smallest.

No, I meant dropping. My initial assumption was that we need to drop N books and N items to make room but in reality we can drop less than 2 N items because dropped book can be treated as item dropped to make room.

Edit. Maybe I used word "combine" in wrong meaning, I didn't mean that we should drop books and other items as one operation.

You are a kobold in a dungeon. The dungeon is in the shape of a ring and you do not know how many rooms there are in the dungeon.

Some of the rooms have their doors open, some have their doors closed. Your job is to close all of the doors. I remind you again that the dungeon is ring shaped, and you do not know how many rooms there are in the dungeon.

How would you close all of the doors, and in the end inform your superior (via your zot phone) that you have completed your job?

drop your phone in the room you start in, walk in a given direction while opening all the doors, once you find your phone again you know every door is open so pick it up and close all the doors

if you're not allowed to drop your phone then do the following:close a door at your starting point, this door is your "phone"* now go in a fixed direction until you see a closed door and remember how far you are from the initial closed door (say by counting the number of doors)open that door and go back to your starting point; if the door is not closed anymore then you've seen every door (and they're all open) so just close every doorotherwise start from * again

CanOfWorms wrote:if you're not allowed to drop your phone then do the following:close a door at your starting point, this door is your "phone"* now go in a fixed direction until you see a closed door and remember how far you are from the initial closed door (say by counting the number of doors)open that door and go back to your starting point; if the door is not closed anymore then you've seen every door (and they're all open) so just close every doorotherwise start from * again

A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

No, because goblins deserve death.

In this case you should clearly switch because then you have a 100% chance of picking a fake lever!

A trolley cart is heading down a path, on which there are Aleph 1 people. You may pull a lever to direct it onto another path, on which there are Aleph 0 people. Should you pull the lever? You may assume the Axiom of Choice and the Generalized Continuum Hypothesis for simplicity.

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

No, because goblins deserve death.

In this case you should clearly switch because then you have a 100%66% chance of picking a fake lever!

Hands wrote:Ok, in my original post you partition the set of books into k subsets, we use r_1,...,r_k to denote the size of the subsets. We assume that the r values are in ascending order of size....Since r_1+...+r_k = N this simplifies to N + r_k + k + 1, and this will be minimized when r_k + k is minimal. I think but haven't proved that minimizing this will give 2*sqrt(N) rounded up.

duvessa wrote:A boulder beetle is rolling towards 5 goblins. There are three levers, one of which will divert the boulder beetle's course so that it only hits 1 hobgoblin. The other two levers are fake and have no effect. You may pull only one lever. After choosing your lever, one of the other levers is revealed as fake. Do you switch your choice?

At first you have a 1/3 chance of picking the real lever and a 2/3 chance of picking a fake one. You should not use the original lever is it was a fake one. The chance for this is 2/3 so you should pull the other one. Unless you just want to see the goblins die, in which case you should not use any lever.