# Taking multiplicities into account when counting the elements of a list

Say we have a list

l = {4x,3y,z}

When we do

Count[l,x]

we get, as expected

0

Is there a function, call it F, that takes multiplicities into account, so for example for l

F@l

{4,3,1}

or equivalently a function that extracts multiplicities of each element in a list?

• Your example is probably too simplistic to really represent what you want. For example, F = Coefficient[#, {x, y, z}] & works just fine. Is this what you want? Is there a more complex example where this does not work? May 29 '19 at 17:00

You could use FactorTermsList:
First @* FactorTermsList /@ {4 x, 3 y, z}