Question: How to count ones in binary number?

Here is my command..

 

> mylist:=[4,6,2]: for x from 1 to nops (mylist) do convert (mylist[x], binary) end do;

> z:=map(convert, mylist, binary);

[100, 110, 10]

> map2(nprintf,"%08d",z);

[00000100, 00000110, 00000010]

 

how I need to continue the command to get the number of 1s in each of the binary number? 

Thank you~=]]

`00000100`, `00000110`, `00000010`

Please Wait...