# Calculating products made within a certain amount of time

I have an interesting question that I'm having a hard time figuring out how to diagram/solve.

The problem is about a product's process cycle. So the amount of steps it takes to make said product and how much time each step of the process takes. Steps are done 1-6 in order (you can't jump around). When a product finishes Step 1 a second product can then move into Step 1 but cannot move into Step 2 until the first product is done that step. The steps all have different times. The question is how many products can be produced in one hour. It'd be great to see a simple formula for this, Thanks!

Step 1: 15 seconds Step 2: 30 seconds Step 3: 60 seconds Step 4: 40 seconds Step 5: 20 seconds Step 6: 30 seconds

-

For the specific values you've presented, the process will be limited by the longest delay in the line, 60 seconds. After the initial waiting time of 195 seconds, the next part (and each one thereafter) will be completed 60 seconds later. So assuming you're already in a running state, then generating 1 Product a minute results in 60 products an hour. If however, you need to include the initial waiting interval, then ~56 products in the first hour, 60 thereafter.

-

So, this was actually pretty fun to do, and you could see this if work through it like I did.

We know that the first one will take 15 + 30 + 60 + 40 + 20 + 30 seconds. Then, the second one will start the moment the first one is through with the 15 seconds (step 1). So, the second one finishes its 15 seconds (step 1), but it still has to wait for the first one to get past the 30 seconds (step 2), so step 1 for the second one will take as long as step 2 for the first one. Note, this pattern will continue and stop once the amount of time for step $n + 1$ is less than the amount of time for step $n$.

I illustrate the situation as follows for the first 6 parts, but we will notice that as great as it is as a starting point, it is wrong (but we will fix it quickly!).

15 + 30 + 60 + 40 + 20 + 30                                 part 1
30 + 60 + 60 + 40 + 20 + 30                            part 2
60 + 60 + 60 + 40 + 20 + 30                       part 3
60 + 60 + 60 + 40 + 20 + 30                  part 4
60 + 60 + 60 + 40 + 20 + 30             part 5
60 + 60 + 60 + 40 + 20 + 30        part 6


At first glance, this seems correct. In the sense that the 30 seconds for the second part will occur during the 30 seconds for the first part, and because the 30 seconds are happening at the same time, we could count it as one 30 second interval! This seems to work out for the second step of part 2 as well. Note, this is also when the third part starts, and it has to wait 60 seconds, but because we have 3 60 second operations happening at one time, then clearly this only counts as 1 60 second interval. So far, so good. Next, we see that part 1 goes through a 40 second step, while parts 2, 3, 4 go through a 60 second step (parts 3 and 4 have to wait for part 2, which is going through the 60 second step). How does this work? 1 40 second interval... 3 60 seconds happening at once... Well, the easiest way will actually lead us to our solution. Starting from the top row, everywhere we see smaller number on top of a larger number, we have to split the larger number into two numbers, $a,b$. $a$ is the number above it, and the $b$ is difference.

For example, step 4 of part 1 takes 40 seconds, and step 3 of part 2 takes 60 seconds, so what we get is 40 seconds for the $a$, and $60 - 40 = 20$ seconds for $b$. What we do next is we replace the 60 in part 2 for $a$, and shift everything to the right after it, and placing the difference, $b$:

15 + 30 + 60 + 40 + 20 + 30
30 + 60 + 40 + 20 + 40 + 20 + 30


Now, we have that issue again, but with the 30 and 40 this time! So, we do the same thing one more time:

15 + 30 + 60 + 40 + 20 + 30
30 + 60 + 40 + 20 + 30 + 10 + 20 + 30


There, we're finished. As we could see, it'll take 60 extra seconds for the two parts to finish. If we apply this to our 6 parts from top down, we notice something:

15 + 30 + 60 + 40 + 20 + 30
30 + 60 + 40 + 20 + 30 + 10 + 20 + 30
60 + 40 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30
40 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30
20 + 30 + 10 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30 + 30
30 + 10 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30 + 30 + 20
10 + 20 + 30 + 10 + 20 + 30 + 10 + 20 + 30 + 30 + 20 + 30
10 + 20 + 30 + 20 + 30 + 10 + 20 + 30 + 30 + 20 + 30 + 10


From here, we saw some weird activity as we tailored off, but if we were to keep going, we would see that the weird activity would have been less than 60 continuously. From this we could see that our first part will take 195 seconds, and every part after that will take up at most an extra 60 seconds (the $10 + 20 + 30$ trailing at the ends).

So, we have $195 + 60(n-1) \leq 3600$. When you solve for n, you get $n = 57$.

-

Let $a=(15,30,60,40,20,30)$, $d_{max}=\max(a)=60$.

Then the first product is finished at time $\sum a=195$ s.

After that, each product is finished with delay $d_{max}=60s$, thus at $255$, $315$, $\ldots$

So solving $195+60(n-1)\le3600$ in $\mathbb{N}$ would result in the maximum $n=57$, which is the final number of products.

-