Problem

Return the smallest integer factor of n greater than 1, or n if prime (n >= 2).

Examples

  • firstFactor(15) -> 3
  • firstFactor(7) -> 7
Compile and test (Ctrl+Enter)