Minimum time for parallel execution Suppose to have 2 worker and they must do a task multiple times.
Worker A and Worker B have a different work speed. 
How can I calculate the minimum time for doing the task N times?
For example:
I need to do the task 15 times. Worker A finish a single task in 5 minutes, Worker B in 10 minutes.
Minimum time is 50 minutes.
And in general, how can I calculate the minimum time having N workers and M different tasks? (total number of execution per task and execution times per worker/task are known)
 A: Suppose worker $A$ takes $a$ minutes per task, and worker $B$ takes $b$ minutes per task. Then in $t$ minutes, they can do $\frac{t}{a}+\frac{t}{b}$ tasks. This assumes $t$ is evenly divisible by $a$ and $b$; if not, then we should take $\left\lfloor \frac{t}{a}\right \rfloor + \left\lfloor \frac{t}{b}\right \rfloor $ if they cannot do a task together, or $\left \lfloor \frac{t}{a}+\frac{t}{b}\right\rfloor$ if they can work together on a single task. If we need to complete $N$ tasks, then the minimum time needed is the minimum $t$ such that the previous quantities are equal to $N$. For simplicity, let's solve the equation without the floor function:
\begin{align*}
\frac{t}{a}+\frac{t}{b}&=N\\
t&= \left(\frac{1}{a}+\frac{1}{b}\right)^{-1} N\\
&=\frac{abN}{a+b}
\end{align*}
In this time, the number of tasks completed by $A$ is $\frac{t}{a}=\frac{bN}{a+b}$ and the number completed by $B$ is $\frac{t}{b}=\frac{aN}{a+b}$. This solution is the same if $A$ and $B$ can work on tasks together (but they may end up doing fractional numbers of tasks). You can generalize this to $M$ workers by solving $\frac{t}{a_1}+\cdots+\frac{t}{a_M}=N$.
Now if each person has to do a whole number of tasks, we need to increase $t$ until $\left\lfloor\frac{t}{a}\right\rfloor+\left\lfloor \frac{t}{b}\right\rfloor=N$. Writing down a nice formula for $t$ is complicated, because who we give the fractional tasks to depends on how fast each worker completes tasks, and what fraction of a task they can complete by time $t$ (e.g., if worker $A$ has completed $3.1$ tasks and worker $B$ has completed $0.9$ tasks, then it may be better to give the $0.1$ fractional task to worker $B$ even if they are slower). However, you only need to check two values of $t$, since we will either round up $A$'s tasks by $1$ and round down $B$'s tasks by $1$, or vice versa. In the $M$-worker case it gets more complicated, but you still only need to check finitely many values of $t$.
