Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- bool prime[10000000];
- void eratostene()
- {
- long long unsigned int i,j;
- long long unsigned int r;
- for(i=1;i<=100000;++i)
- {
- if(prime[i] == 0)
- {
- j = (i<<1)+1;
- for(r = j*j;r<=1000000;r+=(j<<1))
- prime[(r-1)>>1]=1;
- }
- }
- }
- int main()
- {
- int a,b;
- //cin >> a >> b;
- int i;
- int prim=0;
- long long unsigned x;
- eratostene();
- cout << prime[4];
- /*
- x = a*a+a+41;
- cout << prim;
- for(i=a;i<=b;++i)
- {
- if(prime[(x-1)>>1] == 0)
- ++prim;
- x += (i+1)<<1;
- }
- */
- return 0;
- }
Add Comment
Please, Sign In to add comment