7 kyu

How many twos?

569 of 1,584Nmistrata

Description:

Write a function that returns the number of '2's in the factorization of a number.
For example,

two_count(24)
two_count(24)
twoCount(24)
twoCount 24
twoCount 24
TwoCount(24)
two-count 24

should return 3, since the factorization of 24 is 2^3 x 3

two_count(17280)
two_count(17280)
twoCount(17280)
twoCount 17280
twoCount 17280
TwoCount(17280)
two-count 17280

should return 7, since the factorization of 17280 is 2^7 x 5 x 3^3
The number passed to two_count (twoCount) will always be a positive integer greater than or equal to 1.

Algorithms

Stats:

CreatedFeb 1, 2016
PublishedFeb 1, 2016
Warriors Trained2717
Total Skips145
Total Code Submissions3887
Total Times Completed1584
Python Completions569
JavaScript Completions545
Ruby Completions179
CoffeeScript Completions18
Haskell Completions138
C# Completions191
Clojure Completions78
Total Stars35
% of votes with a positive feedback rating91% of 230
Total "Very Satisfied" Votes197
Total "Somewhat Satisfied" Votes26
Total "Not Satisfied" Votes7
Total Rank Assessments20
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Nmistrata Avatar
  • CrazyMerlyn Avatar
  • Jotha Avatar
  • NaMe613 Avatar
  • kazk Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • saudiGuy Avatar
Ad