*L-99 is a list of Prolog challenges with solutions in Lisp. However, the solutions you can find here are written in **q.*

Construct a list containing the prime factors and their multiplicity.

**Example**

`* (prime-factors-mult 315)`

((3 2) (5 1) (7 1))

Hint: The problem is similar to problem P13.

**qSolution**

Looking at the above example we can notice that this problem is more similar to P10 because of factors with singular multiplicity. If it was similar to P13, than the grouping should look like:

`* (prime-factors-mult 315)`

((3 2) 5 7)

The current problem differs from P10 because of the order of elements in each sublist. In P10 we were assuming that the output consist of pairs *(multiplicity; element)*. Now it is the other way around.

The solution is very simple as we can use functions defined in P10 and P35:

`primeFactorsMult:{[x]`

:**reverse each** encode primeFactors x;

};

**Example**

`primeFactorsMult 5`

5 1

`primeFactorsMult 315`

3 2

5 1

7 1