From ba62ec791294942562b45218aad94a02e63b9681 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Fri, 22 Nov 2024 11:51:12 -0600 Subject: [PATCH] golf --- library/math/prime_sieve/get_prime_factors.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/math/prime_sieve/get_prime_factors.hpp b/library/math/prime_sieve/get_prime_factors.hpp index 1e728e50..7ea9284b 100644 --- a/library/math/prime_sieve/get_prime_factors.hpp +++ b/library/math/prime_sieve/get_prime_factors.hpp @@ -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) \ No newline at end of file