A signal which is a function of a set of periodic signals with periods $p_1,\dotsc, p_n$ will have a period $P$ which is the least common multiple of all $p_i$. (If $p_i$ are relatively prime, which is the only relevant case here, then $P = \prod_i p_i$.)
Assume that each $p_i$ must be an integer and greater than some constant $k$.
What is a straightforward algorithm which will list, for each possible $P$ in increasing order, the values of $n$ and $p_1,\dotsc, p_n$ which minimize $\sum_i (12 + 3\lceil (p_i - 1)/4 \rceil)$ (the cost of the signal generators)?
For those curious about the application, or wondering if this is homework, I am constructing a virtual logic circuit in the game Minecraft; I wish to produce a long (relative to the logic elements' propagation time) delay using a minimum of resources. I am using a group of clocks with differing periods and ORing the outputs, so that the output has a period which is the product of the individual periods as described. I have found a satisfactory result by trial and error, but I'd like to also find and document a systematic solution.