Skip to main content
Commonmark migration
Source Link

Matlab, 13 bytes

#Matlab, 13 bytes de2bi creates a vector of zeros and ones representing the binary number, and sum just returns the sum of all the entries.

sum(de2bi(n))

#Matlab, 13 bytes de2bi creates a vector of zeros and ones representing the binary number, and sum just returns the sum of all the entries.

sum(de2bi(n))

Matlab, 13 bytes

de2bi creates a vector of zeros and ones representing the binary number, and sum just returns the sum of all the entries.

sum(de2bi(n))
Source Link
flawr
  • 43.9k
  • 7
  • 104
  • 249

#Matlab, 13 bytes de2bi creates a vector of zeros and ones representing the binary number, and sum just returns the sum of all the entries.

sum(de2bi(n))