Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int a,b;
- bool kt(int n)
- {
- bool ok = true;
- if (a!=1)
- {
- for (int i = 2;i<=sqrt(a);i++)
- {
- if (a % i == 0)
- {
- ok = false;
- break;
- };
- }
- } else ok = false;
- return ok;
- }
- void duyet()
- {
- int x[b-a+1] = {0};
- for (int i = 0;i<=b-a;++i)
- {
- if (x[i] == 0 && kt(i+a) == 1)
- {
- x[i] = 1;
- if (i+a != 1)
- {
- int j = i*i;
- while (j <= b-a)
- {
- j+=i;
- x[j] = -1;
- }
- }
- }
- }
- for (int i = 0;i<=b-a;++i)
- {
- if (x[i] == 1)
- {
- cout << i+a << endl;
- }
- }
- }
- int main()
- {
- cin >> a >> b;
- return 0;
- }
Add Comment
Please, Sign In to add comment