Advertisement
Guest User

10sept2019

a guest
Sep 10th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <time.h>
  4.  
  5. int main(int argc, char **argv)
  6. {
  7.     int q = 0;
  8.     clock_t start, end;
  9.     start = clock();
  10.     for(int i = 2; i < 100000; i++) {
  11.        
  12.         int ndelers = 2;
  13.         for(int j = 2; j < i; j++) {
  14.             ndelers += i % j == 0;
  15.             if(ndelers > 4)
  16.                 break;
  17.         }
  18.         if(ndelers == 4) {
  19.             q++;
  20.         } else {
  21.             q = 0;
  22.         }
  23.         if(q == 3) {
  24.             printf("i is %3d, ndelers is %d\n", i-1, ndelers);
  25.         }
  26.     }
  27.     end = clock();
  28.     printf("time was %lu.%lu\n", (end - start) / CLOCKS_PER_SEC, (end - start) % CLOCKS_PER_SEC / 10000);
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement