Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #define pii pair <int, int>
- using namespace std;
- void cv(vector <int> v) {
- for (int i: v) {
- cout << i << ' ';
- }
- cout << "\n";
- }
- int f(int n) {
- vector <pii> div;
- for (int i = 2; i <= sqrt(n); ++i) {
- if (n % i == 0) {
- int cnt = 0;
- while (n % i == 0) {
- n /= i;
- cnt++;
- }
- div.push_back({i,cnt});
- }
- }
- if (div.size() > 1) {
- return -1;
- }
- if (div[0].second % 2 == 1) {
- return -1;
- }
- int div_num = div[0].second;
- for (int i = 2; i <= sqrt(div_num); ++i) {
- if (div_num % i == 0) {
- return -1;
- }
- }
- return div[0].second;
- }
- bool cmp(pii a, pii b) {
- return a.second > b.second || a.second == b.second && a.first > b.first;
- }
- int main()
- {
- vector <bool> prime(10010,1);
- vector <int> pr = {2,3};
- /*for (int i = 2; i < 10010; ++i) {
- for (int j = 2*i; j < 10010; j += i) {
- prime[j] = 0;
- }
- }
- for (int i = 2; i < 10010; ++i) {
- if (prime[i]) {
- pr.push_back(i);
- }
- }*/
- for (int i = 4; i < 10010; ++i) {
- bool ok = 1;
- for (int j = 2; j <= sqrt(i); ++j) {
- if (i % j == 0) {
- ok = 0;
- }
- }
- if (ok) {
- pr.push_back(i);
- }
- }
- //cv(pr);
- for (int n: pr) {
- //n - простое
- int i = 0;
- while (pow(n, pr[i] - 1) < 10 * pow(10,6);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement