Kata Workshop

Problem

Compute the prime factors of a given number.

Note: A prime number is only divisible by itself and 1. 1 is not a prime number.

Examples

  • 0 does not have any prime factors.
  • 1 does not have any prime factors.
  • 2 has the following prime factor: 1.
  • 3 has the following prime factors: 3.
  • 4 has the following prime factors: 2, 2.
  • 8 has the following prime factors: 2, 2, 2.
  • 9 has the following prime factors: 3, 3.
  • 25 has the following prime factors: 5, 5.

Learning Outcomes

  • Three Rules of TDD
  • Red/Green/Refactor TDD Cycle
  • Staying Green While Refactoring
  • Refactoring in Small Steps