Last active
February 2, 2024 07:27
-
-
Save philopaterwaheed/631d30f8e5a214dbf5230de23e95dd09 to your computer and use it in GitHub Desktop.
- Prime factorization is the process of finding the prime factors of a given number `n`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector <pair <long long , int > > pri (long long n ) { | |
vector <pair <long long , int > > f ; | |
for ( long long d = 2 ; d *d <= n ; d++ ) { | |
int p = 0 ; | |
while (n % d == 0 ) { | |
n/= d; | |
p++ ; | |
} | |
if (p) | |
f.push_back ({d,p}); | |
} | |
if (n>1) | |
f.push_back({n,1}); | |
return f ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment