7 kyu

How many twos?

567 of 1,580Nmistrata

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 Trained2715
Total Skips145
Total Code Submissions3875
Total Times Completed1580
Python Completions567
JavaScript Completions543
Ruby Completions179
CoffeeScript Completions18
Haskell Completions137
C# Completions191
Clojure Completions78
Total Stars35
% of votes with a positive feedback rating91% of 229
Total "Very Satisfied" Votes196
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