I know that the title and tags doesn't really help, it doesn't really specify what this question is about. But forgive me, I couldn't come up with a better title. I would dearly request the readers to edit the question title and tags to make it better if possible.
What I did:-
Let, $pq$ be a semi-prime. ($p$ and $q$ are primes)
Now, let there be $a$ primes in between $2$ and $pq$. Call them $q_1,\cdots,q_a$. (So, $\pi(pq)=a+1$)
So, $pq>q_a>\cdots>q_1>2$ and let $q_0=2$
Finally define, $b_a<\cdots<b_0$ s.t. $pq-b_i=q_i$
$\implies pq=b_i+q_i$
$\implies\sum_{i=1}^{a}pq=\sum_{i=1}^{a}(b_i+q_i)$
$\implies apq=\sum_{i=1}^{a}b_i+\sum_{i=1}^{a}q_i$
Let's call the sum over the $q_i$s $Q$
So, $apq=Q+\sum_{i=1}^{a}b_i$
Notice, $Q$ is the sum of all the primes less than $pq$ excluding $2$
So, $Q=(\sum_{P<pq}P)-2$
From this answer I got the formula-
$\sum_{P\leq n}P=n\pi(n)-\sum_{k=1}^{n-1}\pi(k)$
$\implies\sum_{P<pq}P=(pq)\pi(pq)-\sum_{k=1}^{pq-1}\pi(k)$
(Since by definition $pq\neq P$, we can just change $P\leq pq$ to $P<pq$)
$\implies(\sum_{P<pq}P)-2=pq(a+1)-2-\sum_{k=1}^{pq-1}\pi(k)$
$\implies Q=apq+pq-2-\sum_{k=1}^{pq-1}\pi(k)$
$\implies apq=apq+pq-2-\sum_{k=1}^{pq-1}\pi(k)+\sum_{i=1}^{a}b_i$
$\implies pq=2-\sum_{i=1}^{a}b_i+\sum_{i=1}^{pq-1}\pi(i)$
Let $\sum_{i=1}^{pq-1}\pi(i)=\Pi$
So, $pq=2+\Pi-\sum_{j=1}^{a}$
Notice $\Pi=\sum_{j=1}^{a}j(q_j-q_{j-1})+(a+1)(pq-q_a-1)$
To understand why, let's use an example,
$\sum_{i=1}^{21}\pi(i)$
$=\pi(1)+\pi(2)+\pi(3)+\pi(4)+\pi(5)+\pi(6)+\pi(7)+\pi(8)+\pi(9)+\pi(10)+\pi(11)+\pi(12)+\pi(13)+\pi(14)+\pi(15)+\pi(16)+\pi(17)+\pi(18)+\pi(19)+\pi(20)+\pi(21)$
$=[\pi(2)]+[\pi(3)+\pi(4)]+[\pi(5)+\pi(6)]+[\pi(7)+\pi(8)+\pi(9)+\pi(10)]+[\pi(11)+\pi(12)]+[\pi(13)+\pi(14)+\pi(15)+\pi(16)]+[\pi(17)+\pi(18)]+[\pi(19)+\pi(20)+\pi(21)]$
$=[\pi(2)]+[\pi(3)+\pi(3)]+[\pi(5)+\pi(5)]+[\pi(7)+\pi(7)+\pi(7)+\pi(7)]+[\pi(11)+\pi(11)]+[\pi(13)+\pi(13)+\pi(13)+\pi(13)]+[\pi(17)+\pi(17)]+[\pi(19)+\pi(19)+\pi(19)]$
$=\pi(2)(3-2)+\pi(3)(5-3)+\pi(5)(7-5)+\pi(7)(11-7)+\pi(11)(13-11)+\pi(13)(17-13)+\pi(17)(19-17)+\pi(19)(21-19)$
$=1(3-2)+2(5-3)+3(7-5)+4(11-7)+5(13-11)+6(17-13)+7(19-17)+8(21-19)$
$=1(q_1-q_0)+2(q_2-q_1)+3(q_3-q_2)+4(q_4-q_3)+5(q_5-q_4)+6(q_6-q_5)+7(q_7-q_6)+8(21-q_7)$
$=\sum_{j=1}^{7}j(q_j-q_{j-1})+8(21-q_7)$
$=\sum_{j=1}^{\pi(21)-1}j(q_j-q_{j-1})+\pi(21)(21-q_{(\pi(21)-1)})$
Now replacing $21$ with $pq-1$ give us
$=\sum_{j=1}^{\pi(pq-1)-1}j(q_j-q_{j-1})+\pi(pq-1)(21-q_{(\pi(pq-1)-1)})$
$=\sum_{j=1}^{a}j(q_j-q_{j-1})+(a+1)(pq-q_a-1)$
Now let's write $q_j-q_{j-1}$ in terms of $b_j$
So, $q_j-q_{j-1}=(pq-b_j)-(pq-b_{j-1})=b_{j-1}-b_j$
And, $pq-q_a=b_a$
So, $\Pi=\sum_{j=1}^{a}j(b_{j-1}-b_j)+(a+1)(b_a-1)$
Finally, $pq=2+\Pi-\sum_{j=1}^{a}b_j$
$=2-\sum_{j=1}^{a}b_j+\sum_{j=1}^{a}j(b_{j-1}-b_j)+(a+1)(b_a-1)$
$=2+(a+1)(b_a-1)+\sum_{j=1}^{a}jb_{j-1}-\sum_{j=1}^{a}jb_j-\sum_{j=1}^{a}b_j$
$=2+ab_a-a+b_a-1+\sum_{j=1}^{a}jb_{j-1}-\sum_{j=1}^{a}jb_j-\sum_{j=1}^{a}b_j$
$=1-a+\sum_{j=1}^{a}jb_{j-1}-\sum_{j=1}^{a-1}jb_j-\sum_{j=1}^{a-1}b_j$
$=1-a+\sum_{j=1}^{a}jb_{j-1}-\sum_{j=1}^{a-1}(j+1)b_j$
$=1-a+\sum_{j=0}^{a-1}(j+1)b_j-\sum_{j=1}^{a-1}(j+1)b_j$
$=1-a+b_0+\sum_{j=1}^{a-1}(j+1)b_j-\sum_{j=1}^{a-1}(j+1)b_j$
$=1-a+b_0$
$=1-a+pq-2$
$=pq-a-1$
So, $pq=pq-a-1$
$\therefore a=-1$
WTF!!??
My question:-
Obviously $a\neq -1$. But my calculation shows that it is.
I have a very bad habit of making silly mistakes in mathematics.
So it would really help if someone tells me that what mistake I have done. There must be a mistake.