You are viewing a single comment's thread. Return to all comments →
Python 3
def divisors(n): c2 = 0 p = 1 while p * p <= n: if n % p == 0: if p % 2 == 0: c2 += 1 if p != n // p and (n // p) % 2 == 0: c2 += 1 p += 1 return c2
Java 8
public static int divisors(int n) { int c2 = 0; int p = 1; while (p * p <= n) { if (n % p == 0) { if (p % 2 == 0) c2++; if (p != n / p && (n / p) % 2 == 0) c2++; } p++; } return c2; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Divisors
You are viewing a single comment's thread. Return to all comments →
Python 3
Java 8