Can you really count divisors? Time : Space : 1234567long countDivisors(const long& n) { long long sum = 0; for (long long i = 1; i <= sqrt(n); i++) { sum += n / i; } return 2 * sum - (long long)sqrt(n) * (long long)sqrt(n);}