Guest User

Untitled

a guest
May 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long n, test, result=0, i, j;
  6. while (1) {
  7. cin >> test;
  8. if (test == 0) { return 0; }
  9. else if (test == 1) { cout << 1 << '\n';}
  10. else {
  11. for (i = test + 1; i <= 2 * test; i++) {
  12. if (i % 2 != 0) {
  13. for (j = 3; j*j <= i; j += 2) {
  14. if (i%j == 0) { result--; break; }
  15. }
  16. result++;
  17. }
  18. }
  19. cout << result << '\n';
  20. result = 0;
  21. }
  22. }
  23. return 0;
  24. }
Add Comment
Please, Sign In to add comment