Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- int main()
- {
- int t, i, j, k, l, a, b, c, d, x, y, z, p, q, r, n, m, flag, count;
- int ar[1000], ar2[1000];
- ar[0] = 2, ar[1] = 3, ar[2] = 5, ar[3] = 7, ar[4] = 11;
- for (j = 5; j < 800; j++)
- {
- n = ar[j - 1];
- for (k = n + 2; ;k = k + 2)
- {
- flag = 0;
- for (l = 0; l < j; l++)
- {
- if (ar[l] > k) {flag = 2; break;}
- if (k % ar[l] == 0) flag = 1;
- }
- if (flag == 0)
- {
- ar[j] = k;
- break;
- }
- }
- }
- for (; ;)
- {
- scanf("%d", &n);
- if (n == 0) break;
- flag = 0, count = 0, x = n;
- for (j = 0; ;)
- {
- if (ar[j] > n)
- {
- break;
- }
- if (n % ar[j] == 0 && flag == 0)
- {
- n = n / ar[j];
- flag = 1;
- count++;
- }
- else
- {
- j++;
- flag = 0;
- }
- }
- for (j = 0; ;j++)
- {
- if (ar[j] > n) break;
- if (ar[j] == n)
- {
- count++;
- }
- }
- printf("%d : %d\n", x, count);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement