If I understand the question correctly, a solution to the problem will have
the form of a (rooted) tree. Each vertex of the tree will be labeled with a
set of positive integers, which is either what remains of $A$, at the
root, or a spin-off of $A$, a spin-off of a spin-off of $A$, etc. at vertices
which are not the root. The sets of positive integers must fulfill the
following constraints:
(1) They are nonempty and disjoint;
(2) All integers in all sets divide the original lcm, $M$;
(3) The union of the sets contains the original set $A$;
(4) For each set, its gcd is divisible by its anchor, which is a member
of the set at its parent vertex (if the set is not at the root) or
a fixed, given, number $r$ not appearing in any set (if the set is at the root.)
Given such a tree, its cost is $M \sum_v (\#S_v)/a_v$, where $v$ ranges over
the vertices of the tree, $S_v$ is the set at vertex $v$, and $a_v$ is the
anchor of the set at vertex $v$.
First, observe that if a vertex is labeled with a set of size larger than 1,
$\{c_1,\ldots,c_t\}$, say, we can split it into $t$ vertices, labeled
with $\{c_1\}$, $\{c_2\}$, $\dots$, $\{c_t\}$, and reapportion its child vertices
among these vertices so that each child set is beneath its anchor. This does
not change the cost of the tree, so after doing this repeatedly,
we may assume that all sets have size 1, i.e., each
vertex is labeled with a single number. Second, observe that we may add
a vertex above the root labeled with the original anchor. These two steps
reduce the problem to the problem of finding a rooted tree whose vertices
are labeled with distinct positive integers which satisfies
(a) All labels divide $M$;
(b) The root is labeled with $r$, the original anchor;
(c) The set of labels contains the original set $A$; and
(d) the label at the top of each edge divides the label at the bottom,
and which has minimum cost, where the cost is now $M$ times
the sum over all edges of the reciprocal of the label at the top of the edge.
Also, we may now allow $r$ to be a member of $A$, and we observe that there is
no need to require the vertex labels to be distinct, since if we had two
vertices with the same label, we could construct a cheaper tree by deleting one of them and reapportioning all its children to the other.
Let $T$ be an minimum-cost tree for $r$, $M$ and $A$.
Observe that:
(i) Each of the leaves of $T$ must be
labeled with a member of $A$, since otherwise we could construct a
cheaper tree by removing a leaf.
(ii) If a vertex other than the root has exactly 1 child, it must be labeled
with a member of $A$, since otherwise it would be cheaper to remove the vertex
and reapportion its child to its parent.
(iii) If a vertex other than the root has 2 or more children and is not
labeled with a member of $A$, we can assume that its label equals the gcd of the labels of its children, since otherwise we could make a
cheaper tree by relabeling it with the gcd of the labels of its children.
(iv) Fix some parent vertex $v$ of leaves, and let it have label $l$ and leaf children
$w_1$, $\ldots$, $w_t$ with
labels $s_1$, $\ldots$, $s_t$. Then if we delete $w_1$, $\ldots$, $w_t$ from $T$, the remaining tree, $T'$, must be minimum-cost
for $r$, $M$, and the set $A\cup\{l\}\setminus\{s_1,\ldots,s_t\}$, since if
there was a cheaper tree, $T''$, say, for this set, we could make a tree cheaper
than $T$ for $A$ by attaching the children $w_1$, $\ldots$, $w_t$
to the vertex labeled $l$ in $T''$.
Rules (i)-(iv) give us a recursive algorithm for finding an optimal tree $T$.
If $A$ is empty or $A=\{r\}$, we are done since the optimal tree consists of only the
root vertex and has cost 0. Otherwise, $T$ must have at least one
leaf, and since, by (i), all leaves are labeled with a member of $A$,
there must be some subset $\emptyset\ne S\subseteq A$ and some vertex $v$
such that $v$ has only leaf children and $S$ contains
the set of labels of the set of leaves, $W$, which are children of $v$. Then, by (ii) and (iii), the label of $v$, $l$, must be either
$r$, some member of $A$, or $\gcd(S)$. Now,
let $T'$ be $T$ with the vertices in $W$ removed; by (iv), we can
compute $T'$ by calling the algorithm again to find an optimal tree for
$A\cup\{l\}\setminus S$, and then $T$ can be reconstructed by reattaching
the children $W$ to $v$. Performing this step for all possible choices of $S$ and $l$ will give a set of possibilities for $T$ from
which we can take the best possible answer.
Not a real answer to your question or a complete answer but :
It's more about the number of cookies you want to bake before reseting than the time you want to wait before reseting.
Suppose you want to bake $n$ more cookies before selling all your buildings (without buying the supplementary prism). Suppose the boost given by a supplementary prism take your production from $P$ to $P(1+\alpha)$. If you play as hard and as long with that extra prism than without you'll produce $n(1+\alpha)$ cookies before selling your buildings. So the extra cookie given by the extra prism will amount to $\alpha \cdot n$.
Now the amount of cookies lost by the extra prism in the use of chocolate egg is (without the auras) $0,05\times0,5\times$cost of the extra prism. If this quantity is inferior to $\alpha\cdot n$ then it's more efficient to buy the prism. With the auras (and believe me it's more efficient to switch to the aura to sell at 85%) there is a shifting of one prism and the amount of cookie lost is $0,05\times 0,15 \times $cost of the prism before the extra prism. For the other buildings it's juste $0,05\times 0,15 \times$ cost of the extra building.
I think it's better to think in terms of number of cookies before reseting because with this technique you can take account of the cookies given by the golden cookies (which account for the majority of your cookies for an active gameplay). If you just play by iddeling then number of cookies before reset and time before reset are roughly the same thing, you can deduce one from the other easily as they're proportional.
However this is all theoretical and it doesn't really matter. The amount of lost cookies by buying lots of building is usually negligible, especially with the update with auras. The difference between best chocolate egg strategy and "buying everything i can" strategy is only about $0,75$% of your bank.
Best Answer
As Patrick87 points out, $\forall m,n\ge 2 : mn \ge m+n$, so we always want to construct using prime factors.
Denote the target block sizes as $\{t_i\}$. We can express the construction costs as a directed graph with vertices corresponding to $\mathbb{Z}^+$ and edges $n\to pn$ with weight $p$ for all $n$ and all prime $p$. The task is to find the connected subgraph containing $\{t_i\} \cup \{1\}$ which has least total weight.
We can make the following observations:
If there is only one target, $n$, the optimal solution is $\text{sopfr}(n)$ where sopfr (A001414) is the sum of prime factors with repetition. In fact we can claim a stronger property: any path from $1$ to $n$ will have total weight $\text{sopfr}(n)$, differing only in the order of the primes.
If the targets can be partitioned into $\{a_j\}, \{b_k\}$ such that $\forall j,k : \gcd(a_j, b_k) = 1$ then the problem can be split into independent subproblems for the $\{a_j\}$ and $\{b_k\}$. Proof: if a vertex other than $1$ is included in the optimal subgraph for the $\{a_j\}$ then it is not a factor of any of the $\{b_k\}$, and hence were it in the optimal subgraph for the $\{b_k\}$ it could be removed, contradicting the optimality.
If there is a common divisor $d$ of all the $\{t_i\}$ then we can reduce to the problem with targets $\left\{\frac{t_i}{d}\right\}$ and add $\text{sopfr}(d)$ to get an optimal solution. As Ross Millikan observes, this is obvious; it's easy to prove when there are only two targets, and when there are more I believe a proof by contradiction is possible, although not very elegant.
This is already a complete solution for $|\{t_i\}| \le 2$.
In the non-trivial case with three targets they must be decomposable as $axy, bxz, cyz$ where $x,y,z>1$ and $\gcd(ay,bz) = \gcd(ax,cz) = \gcd(bx, cy) = 1$. Then suppose wlog that we construct the first pairwise GCD, $x$. This leads to total cost $$\begin{eqnarray}C & = & \text{sopfr}(x) + \text{sopfr}(ay) + \text{sopfr}(bz) + \text{sopfr}(cyz) \\ & = & \text{sopfr}(x) + 2\text{sopfr}(y) + 2\text{sopfr}(z) + \text{sopfr}(a) + \text{sopfr}(b) + \text{sopfr}(c) \end{eqnarray}$$ Therefore it is optimal to construct the pairwise GCD with the greatest sopfr in this case. (NB not necessarily the greatest pairwise GCD - consider $\text{sopfr}(8) = 6 < \text{sopfr}(7)$).
If you just need a better-than-trivial approximation the following greedy strategy is better than nothing:
But there's a reduction from vertex cover which proves that the problem is NP-complete, so don't hold out much hope for a tractable general solution.
With credit to user946850 for the key idea:
We sketch an argument that the problem is NP-complete by reduction from the vertex cover problem. Since NP is formally a class of decision problems, we must restate the problem in a decision form:
The vertex cover problem is stated as:
We can assume wlog that the graph is connected, so (abusing notation by allowing the sets in a scalar context to be interpreted as their sizes) $E = \Omega(V)$ and $E = O(V^2)$.
The reduction strategy we take is to map each $v_i \in V$ to a distinct prime $p_i$ and each edge $(v_i, v_j) \in E$ to a target block size $p_i p_j$. Then any vertex cover $C'$ can be represented as building the primes corresponding to the vertices in $C'$ and from these building the targets. The cost will be the sum of $|C'| + |E|$ non-distinct primes drawn from $\{p_i\}$. If we call the smallest of the primes used $p_{min}$ and the greatest $p_{max}$, we can set a target cost of $(k + E)p_{max}$ and it is sufficient that $(k+E+1)p_{min}$ is greater for the answer given by the reduced problem to be the answer to the original problem.
Therefore we need to find a prime $p_{min}$ such that there are $V$ primes in the half-open interval $[\;p_{min},\;(1+\epsilon)p_{min})$ where $\epsilon^{-1} = k + E$. We also need to identify all $V$ primes. Here we will keep things simple (hence "sketch an argument" rather than "prove") by merely using the simplest form of the prime number theorem. We're going to check $\Theta(\epsilon\; p_{min})$ numbers for primality, and we need $V$ hits, so we want $\frac{p_{min}}{\log p_{min}} = \Theta(\epsilon^{-1} V )$. This will give $p_{min} = O(E^2 V^2)$ (which can be strengthened to $p_{min} = O((EV)^{1+\alpha})$ for any $\alpha > 0$), which is polynomial in the size of the input to the vertex cover problem, that input size being $\Theta(E \log V)$. The number of candidate numbers which must be checked is also polynomially bounded, and since their sizes are polynomially bounded and primality testing is in P the total cost of performing the reduction is polynomial.