Analytic function to find k-almost primes from prime factorization I need to find an analytic sequence that I can use to generate k-almost primes, for a fixed k, given the prime decomposition. Writing software to do this is easy, but these kinds of programs don't lend themselves to helping with proofs once a pattern is actually detected.
I came up with my own analaytic function to generate all k-almosts primes using the work of IVlad and FindSequenceFunction in Mathematica, but this doesn't let me generate $k$-almost primes for a fixed $k$. Here is my analytic function to get an idea of the kinda of answer I am looking for:

Where the symbols are $p_n$ is the $n^{th}$ prime in the set $S$ and $m$ is the row that we index through. Lastly, $\overline{S}$ is the cardinality of $S$. The other symbols are just indices. An example set is $S$ for 12 is {2,2,3}.
 A: This is a partial answer to help get the ball rolling.
To solve this, I am starting by creating an iterative formula of the generalization of the type of sequences in my comments. A recursive sequence is clearly possible, but ideally we want an iterative one.I recognized the recursion by graphing the sequences in the comments. Recursion makes sense because no matter the number, it's representation is in infinitely many other ones. For example, for '1101' shows up in '11101'. Here is a demonstration:

I will write the sequence as $f(m,n,i)$, where $m$ is the number of digits, $n$ is the number of ones in the binary expression, and $i$ gives the order of the numbers according to m and n from least to greatest. Clearly, $m \geq n$ and $1 \leq i \leq {m}\choose{n}$ This will lead to a 4D equation. I want to then form a path going through the range.
Once this sequence is found, my goal is to have it where I can extract the digits of all numbers with a fixed $m = card(P)$, and use it as a power on my sets of primes, P. That way I get all possible combinations.
I plotted a graph to help show patterns using the Mathematica code:
ListPointPlot3D[Partition[Flatten[Table[Partition[Riffle[Riffle[Table[i, {i,1,Length[Select[Range[120000], (Count[IntegerDigits[#, 2], 1] == j) &]]}],Select[Range[120000],(Count[IntegerDigits[#, 2], 1] == j) &]],j, 3], 3], {j, 1, 13}]], 3], PlotStyle -> Automatic,PlotRange -> All]

for the values of $m \leq 120000$ and $1 \leq n\leq 13$, and $i$ is not a variable. I think finding the 3D solution that gives this graph will be harder than for the 4D, but I could be wrong. 

