Skip to main content
1 of 2
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))
flawr
  • 43.9k
  • 7
  • 104
  • 249