6 kyu
Prime factorization
161 of 1,441wengzilla
Description:
The prime factorization of a positive integer is a list of the integer's prime factors, together with their multiplicities; the process of determining these factors is called integer factorization. The fundamental theorem of arithmetic says that every positive integer has a single unique prime factorization.
The prime factorization of 24, for instance, is (2^3) * (3^1).
Without using the prime library, write a class called PrimeFactorizer
whose constructor accepts exactly 1 integer and has an instance method factor
returning a hash where the keys are prime numbers and the values are the multiplicities.
PrimeFactorizer.new(24).factor #should return { 2 => 3, 3 => 1 }
Algorithms
Similar Kata:
Stats:
Created | Apr 13, 2014 |
Published | Apr 13, 2014 |
Warriors Trained | 4479 |
Total Skips | 1130 |
Total Code Submissions | 11110 |
Total Times Completed | 1441 |
Ruby Completions | 161 |
Python Completions | 659 |
JavaScript Completions | 360 |
Java Completions | 321 |
Objective-C Completions | 13 |
Total Stars | 132 |
% of votes with a positive feedback rating | 90% of 225 |
Total "Very Satisfied" Votes | 187 |
Total "Somewhat Satisfied" Votes | 29 |
Total "Not Satisfied" Votes | 9 |