Skip to content

Commit

Permalink
Golf (#105)
Browse files Browse the repository at this point in the history
* golf

* fix

* [auto-verifier] verify commit ba62ec7

---------

Co-authored-by: GitHub <[email protected]>
  • Loading branch information
lrvideckis and web-flow authored Nov 22, 2024
1 parent 25c67e7 commit 2f70d97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion .verify-helper/timestamps.remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"tests/library_checker_aizu_tests/math/n_choose_k.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/num_subsequences.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/partitions.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/prime_sieve.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/solve_linear_mod.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/tetration.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/math/totient.test.cpp": "2024-11-17 14:04:03 -0600",
Expand Down
5 changes: 2 additions & 3 deletions library/math/prime_sieve/get_prime_factors.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "calc_sieve.hpp"
//! `fac` will equal all prime factors of num, increasing
//! `p` will be all prime factors of num, increasing
//! @time O(log(num))
//! @space O(1)
for (int left = num, fac = sieve[left]; left > 1;
fac = sieve[left /= fac])
for (int cpy = num, p; (p = sieve[cpy]) > 1; cpy /= p)
6 changes: 3 additions & 3 deletions tests/library_checker_aizu_tests/math/prime_sieve.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ int main() {
int prev_prime = -1;
#include "../../../library/math/prime_sieve/get_prime_factors.hpp"
{
assert(fac >= prev_prime);
prev_prime = fac;
curr[fac]++;
assert(p >= prev_prime);
prev_prime = p;
curr[p]++;
}
}
for (auto [p, e] : curr)
Expand Down

0 comments on commit 2f70d97

Please sign in to comment.