Let the $3x+1$ map
$$ f(n) = \begin{cases} 3n+1 & \text {if $n$ is odd} \\ \frac{n}{2} & \text {if $n$ is even} \end{cases} .$$
Now we read the Wikipedia's page for the Collatz problem, also known by several names.
Example. Since $f(1)=4$, $f(4)=2$ and $f(2)=1$, the integer $n=1$ is not a counterexample for the Collatz conjecture (in other words, is the easier example of an integer satisfying the conjecture).
In the other hand we know that the pentagonal numbers of the form $$\omega(n)=\frac{3n^2-n}{2}$$ (related with partitions) are defined as $$\omega(n)=\sum_{k=0}^{n-1}(3k+1).$$
Thus if $n-1$ is odd (this is the first case of two, the second case with $n-1$ even) one can deduce easily combining previous and the definition of the $3x+1$ map that $$\omega(n)=1+\sum_{k\in \left\{ 1,3,5,\ldots,n-1 \right\}}f(k)+6\left(\sum_{k\in \left\{ 2,4,6,\ldots,n-2 \right\}}f(k)\right)+\sum_{k\in \left\{ 2,4,6,\ldots,n-2 \right\}}1.$$
Question. I am stuck to get the best concise formula ( I say the previous last identity, if it is neccesary by cases to get also the case $n-1$ is even) with the right notation. I don't know if I should be to use counting funtions to count the number of odd positive integers $\leq n-1$ (respectively even positive integers) or ceil and floor functions. Can you help to get this simple proposition, both cases, with a good notation Thanks in advance.