-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlixeira3.cpp
More file actions
37 lines (29 loc) · 767 Bytes
/
Copy pathlixeira3.cpp
File metadata and controls
37 lines (29 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool isPrimeFast(long long n) {
if (n < 5 || n % 2 == 0 || n % 3 == 0)
return (n == 2 || n == 3);
long long maxP = sqrt(n) + 2;
for (long long p = 5; p < maxP; p += 6) {
if (p < n && n % p == 0) return false;
if (p+2 < n && n % (p+2) == 0) return false;
}
return true;
}
vector<long long> divisores(long long n) {
vector<long long> ans;
for(long long a = 1; a*a <= n; a++) {
if(n % a == 0) {
long long b = n / a;
ans.push_back(a);
if(a != b) ans.push_back(b);
}
}
return ans;
}
int main(){
cout << __gcd(6, 3) << "\n";
cout << (6 * 3)/__gcd(6, 3) << "\n";
return 0;
}