diff options
Diffstat (limited to 'math/mobius.cpp')
| -rw-r--r-- | math/mobius.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/math/mobius.cpp b/math/mobius.cpp new file mode 100644 index 0000000..7830eb1 --- /dev/null +++ b/math/mobius.cpp @@ -0,0 +1,4 @@ +// Laufzeit: O(N*log(log(N))) +int mu[N+1]; mu[1] = 1; +for (int i = 1; i <= N; i++) { + for (int j = 2 * i; j <= N; j += i) mu[j] -= mu[i]; |
