Skip to content

Instantly share code, notes, and snippets.

@alculquicondor
Last active April 22, 2016 14:55
Show Gist options
  • Select an option

  • Save alculquicondor/64fafb2af20139bbbb478d64847bcb1d to your computer and use it in GitHub Desktop.

Select an option

Save alculquicondor/64fafb2af20139bbbb478d64847bcb1d to your computer and use it in GitHub Desktop.
long ans = 0;
for (int i = 2; i <= a; ++i)
if (sieve.isPrime(i)) {
int ap = a / i, bp = b / i;
for (int j = 1; j <= ap; ++j)
ans += u[j] * (long) (ap / j) * (bp / j);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment