Draft
Factorization!
Description:
You believed we are going to build factories now? Ohoh, how wrong you were my friend.
Your task is to write an algorithm that takes a number and returns a string containing the comma-separated list of the prime factors of that number in ascending order. The algorithm should be pretty fast and able to handle any number of the given type, including negative numbers.
If a prime factor is present multiple times in a number, the string should contain it as many times as it is in the number.
Examples:
factorize(15); // should return "3, 5"
factorize(7); // should return "7"
factorize(-69); // should return ""
factorize(420); // should return "2, 2, 3, 5, 7"
factorize(123456); // should return "2, 2, 2, 2, 2, 2, 3, 643"
Algorithms
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Oct 8, 2016 |
Warriors Trained | 117 |
Total Skips | 29 |
Total Code Submissions | 131 |
Total Times Completed | 12 |
Java Completions | 12 |
Total Stars | 6 |
% of votes with a positive feedback rating | 83% of 6 |
Total "Very Satisfied" Votes | 5 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |