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

More By Author:

Check out these other kata created by MazTheMazy

Stats:

CreatedOct 8, 2016
Warriors Trained117
Total Skips29
Total Code Submissions131
Total Times Completed12
Java Completions12
Total Stars6
% of votes with a positive feedback rating83% of 6
Total "Very Satisfied" Votes5
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes1
Total Rank Assessments6
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • MazTheMazy Avatar
Ad