The job has to execute $W$ work items, each takes $t_{exec}$ to execute. The maximum walltime of the job is $t_{max}$. Each work items is executed using $n_t$ threads, each compute node has $n_{ppn}$ cores. How many nodes $N$ should be used to execute the job given these constraints?
Given that items need to be executed in parallel, and all work items require the same time to execute, the total number of times work items will run in parallel is $R$, the number of runs. This is given by $R = \left \lfloor \frac{t_{max}}{t_{exec}}\right \rfloor$. Since both $t_{max}$ and $t_{exec}$ are given, there is no need to reformulate this as inequalities, so
$\frac{1}{\left \lfloor \frac{t_{max}}{t_{exec}} \right \rfloor} = \frac{1}{R}$
The number of items that can run concurrently if it is assumed that one node reserves one core for coordination (the master process, running with one thread) is given by
$n_{conc} = \left \lfloor \frac{n_{ppn} - 1}{n_t} \right \rfloor + (N - 1) \left \lfloor \frac{n_{ppn}}{n_t} \right \rfloor$
Again, $n_{ppn}$ and $n_t$ are given, so no need to expand to inequalities here either.
The number of items that can be running concurrently can also be computed as
$R = \left \lceil \frac{W}{n_{conc}} \right \rceil$
Since we want to solve for $N$, which is in the expression for $n_{conc}$, we have to rewrite the expression above as an inequality.
$ R - 1 < \frac{W}{n_{conc}} \le R$
or
$ \frac{W}{R} \le n_{conc} $
or
$ \left \lceil \frac{W}{R} \right \rceil = n_{conc} $
Combining the expression above and the lower bound for $\frac{1}{R}$ yields
$ \left \lceil \frac{W}{\left \lfloor \frac{t_{max}}{t_{exec}} \right \rfloor} \right \rceil = n_{conc} $
Plugging in the expression $n_{conc}$ into the inequality that contains $N$ yields
$ \left \lceil \frac{W}{\left \lfloor \frac{t_{max}}{t_{exec}} \right \rfloor} \right \rceil - \left \lfloor \frac{n_{ppn} - 1}{n_t} \right \rfloor = (N - 1) \left \lfloor \frac{n_{ppn}}{n_t} \right \rfloor $
Solving for $N$
$ N = 1 + \left( \left \lceil \frac{W}{\left \lfloor \frac{t_{max}}{t_{exec}} \right \rfloor} \right \rceil - \left \lfloor \frac{n_{ppn} - 1}{n_t} \right \rfloor \right) \frac{1}{\left \lfloor \frac{n_ppn}{n_t} \right \rfloor}$