Even or Odd Number of Factors

Published by Helen Yu in

Create a function that returns "even" if a number has an even number of factors and "odd" if a number has an odd number of factors.

Examples

factorGroup(33) ➞ "even"

factorGroup(36) ➞ "odd"

factorGroup(7) ➞ "even"

Notes

  • You don't need to actually calculate the factors to solve this problem.
  • Think about why a number would have an odd number of factors.
Watch a quick demo on how Edabit works.