From 9e625b89bac7e8daaf583e215f3a0df3dc250bb2 Mon Sep 17 00:00:00 2001 From: Paul Jungeblut Date: Mon, 27 Jun 2016 11:17:34 +0200 Subject: Math section rebuild, merged convinience and sonstiges section. --- math/factor.cpp | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 math/factor.cpp (limited to 'math/factor.cpp') diff --git a/math/factor.cpp b/math/factor.cpp deleted file mode 100644 index 621d057..0000000 --- a/math/factor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -typedef pair ii; -//Factorize a number n in its prime factors -//Call primeSieve-method before with N > sqrt(n) -//Return: Returns a vector of pairs, where the first entry in the pair is -//the prime factor p and the second counts how many times p divides n -vector factorize(ll n) { - vector fact; ll num = n, i = 0, c = 0; - while(num != 1) { - if(num % primes[i] == 0) { - c++; num /= primes[i]; - } else { - if(c > 0) - fact.push_back(make_pair(primes[i],c)); - i++; c = 0; - if(primes[i]*primes[i] > num) break; - } - } - if(num != 1) fact.push_back(make_pair(num,c+1)); - return fact; -} \ No newline at end of file -- cgit v1.2.3