Introduction
The prime factors kata is a mathbased kata in which we write a method which will break down any number into a list of its prime factors. This means that we return the set of one or more prime numbers that when multiplied together will give us the initial number. Requirements
Introduction
The prime factors kata is a math-based kata in which we write a method which will break down any number into a list of its prime factors. This means that we return the set of one or more prime numbers that when multiplied together will give us the initial number.
Requirements
Write a class named PrimeFactors that has one static method: generate. The generate method takes an integer argument and returns a collection of integers. That list contains the prime factors in numerical sequence.
Examples
- generate(2) = [2]
- generate(3) = [3]
- generate(4) = [2,2]
- generate(6) = [2,3]
- generate(8) = [2,2,2]
- generate(9) = [3,3]
- generate(10)=[2,5]
- generate(12) = [2,2,3]