diff options
Diffstat (limited to 'math')
| -rw-r--r-- | math/bigint.cpp | 3 | ||||
| -rw-r--r-- | math/longestIncreasingSubsequence.cpp | 2 | ||||
| -rw-r--r-- | math/millerRabin.cpp | 2 | ||||
| -rw-r--r-- | math/piLehmer.cpp | 2 | ||||
| -rw-r--r-- | math/rho.cpp | 2 | ||||
| -rw-r--r-- | math/squfof.cpp | 8 |
6 files changed, 9 insertions, 10 deletions
diff --git a/math/bigint.cpp b/math/bigint.cpp index 1753200..f8e3507 100644 --- a/math/bigint.cpp +++ b/math/bigint.cpp @@ -86,8 +86,7 @@ struct bigint { ll s2 = r.a.size() <= b.a.size() - 1 ? 0 : r.a[b.a.size() - 1]; ll d = (base * s1 + s2) / b.a.back(); r -= b * d; - while (r < 0) - r += b, --d; + while (r < 0) r += b, --d; q.a[i] = d; } q.sign = a1.sign * b1.sign; diff --git a/math/longestIncreasingSubsequence.cpp b/math/longestIncreasingSubsequence.cpp index 357ebcd..a4a8211 100644 --- a/math/longestIncreasingSubsequence.cpp +++ b/math/longestIncreasingSubsequence.cpp @@ -3,7 +3,7 @@ vector<int> lis(vector<int> &seq) { vector<int> L(n), L_id(n), parents(n); for (int i = 0; i < n; i++) { int pos = upper_bound(L.begin(), L.begin() + lisLength, - seq[i]) - L.begin(); + seq[i]) - L.begin(); L[pos] = seq[i]; L_id[pos] = i; parents[i] = pos ? L_id[pos - 1] : -1; diff --git a/math/millerRabin.cpp b/math/millerRabin.cpp index fc9385a..2ec608b 100644 --- a/math/millerRabin.cpp +++ b/math/millerRabin.cpp @@ -1,6 +1,6 @@ constexpr ll bases32[] = {2, 7, 61}; constexpr ll bases64[] = {2, 325, 9375, 28178, 450775, - 9780504, 1795265022}; + 9780504, 1795265022}; bool isPrime(ll n) { if(n < 2 || n % 2 == 0) return n == 2; diff --git a/math/piLehmer.cpp b/math/piLehmer.cpp index 37eff6b..4d1780f 100644 --- a/math/piLehmer.cpp +++ b/math/piLehmer.cpp @@ -16,7 +16,7 @@ void init() { memoB[i] = primes[i - 1] * memoB[i - 1];
for(ll j = 1; j <= cacheA; j++) {
memoA[j][i] = memoA[j][i - 1] - memoA[j /
- primes[i - 1]][i - 1];
+ primes[i - 1]][i - 1];
}}}
ll phi(ll n, ll k) {
diff --git a/math/rho.cpp b/math/rho.cpp index bd30902..4579a01 100644 --- a/math/rho.cpp +++ b/math/rho.cpp @@ -1,7 +1,7 @@ ll rho(ll n) { // Findet Faktor < n, nicht unbedingt prim. if (n % 2 == 0) return 2; ll c = rand() % n, x = rand() % n, y = x, d = 1; - // mulmod or int128 + // mulmod or int128 auto f = [&](ll x){return ((x * x) % n + c) % n;}; while (d == 1) { x = f(x); y = f(f(y)); diff --git a/math/squfof.cpp b/math/squfof.cpp index 8a11a77..78bca73 100644 --- a/math/squfof.cpp +++ b/math/squfof.cpp @@ -1,10 +1,10 @@ using lll = __int128;
constexpr lll multipliers[] = {1, 3, 5, 7,
- 11, 3*5, 3*7, 3*11,
- 5*7, 5*11, 7*11,
- 3*5*7, 3*5*11, 3*7*11,
- 5*7*11, 3*5*7*11};
+ 11, 3*5, 3*7, 3*11,
+ 5*7, 5*11, 7*11,
+ 3*5*7, 3*5*11, 3*7*11,
+ 5*7*11, 3*5*7*11};
lll root(lll x) {
lll r = sqrtl(x);
|
