Prime factorisation in index notation
Description:
You need to create a function ( primeFactorisation() )which takes a non-empty array, of non-negative integers as its argument and returns a 2-dimensional array containing the prime factorisation array of each of it's arguments' elements.
Three examples of correct prime factorisation arrays of 10, 17 and 60:
10 -> [ 1 , 0 , 1 ] //since 10 = 2^1 x 3^0 x 5^1
17 -> [ 0 , 0 , 0 , 0 , 0 , 0 , 1 ] //since 17 = 2^0 x 3^0 x 5^0 x 7^0 x 11^0 x 13^0 17^1
60 -> [ 2 , 1 , 1 ] //since 60 = 2^2 x 3^1 x 5^1
If an element of the given array does not have a prime factorisation, it should be ignored and not included in the returned array. The returned array's elements should be in order, starting with the prime factorisation representing the largest number and finish with the smallest.
primeFactorisation( [ 10 , 2 ] );
returns --> [ [1 , 0 , 1 ] , [ 1 ] ]
primeFactorisation( [ 2 , 10 ] );
Also returns (since 10>2) --> [ [ 1 , 0 , 1 ] , [ 1 ] ]
Similar Kata:
Stats:
Created | Aug 27, 2015 |
Warriors Trained | 134 |
Total Skips | 39 |
Total Code Submissions | 65 |
Total Times Completed | 20 |
JavaScript Completions | 20 |
Total Stars | 4 |
% of votes with a positive feedback rating | 73% of 13 |
Total "Very Satisfied" Votes | 9 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 13 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |