Guest User

Untitled

a guest
Nov 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int a,b;
  6.  
  7. bool kt(int n)
  8. {
  9. bool ok = true;
  10. if (a!=1)
  11. {
  12. for (int i = 2;i<=sqrt(a);i++)
  13. {
  14. if (a % i == 0)
  15. {
  16. ok = false;
  17. break;
  18. };
  19. }
  20. } else ok = false;
  21. return ok;
  22. }
  23.  
  24. void duyet()
  25. {
  26. int x[b-a+1] = {0};
  27. for (int i = 0;i<=b-a;++i)
  28. {
  29. if (x[i] == 0 && kt(i+a) == 1)
  30. {
  31. x[i] = 1;
  32. if (i+a != 1)
  33. {
  34. int j = i*i;
  35. while (j <= b-a)
  36. {
  37. j+=i;
  38. x[j] = -1;
  39. }
  40. }
  41. }
  42. }
  43. for (int i = 0;i<=b-a;++i)
  44. {
  45. if (x[i] == 1)
  46. {
  47. cout << i+a << endl;
  48. }
  49. }
  50. }
  51.  
  52. int main()
  53. {
  54. cin >> a >> b;
  55. return 0;
  56. }
Add Comment
Please, Sign In to add comment