adding scala example for ugly number problem