Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int i, j, x, f, fact = 0, max = 0;
- for (i = 2; i < 10000; i++) {
- x = i;
- f = 0;
- while (x >= 4 && x % 2 == 0) {
- f++;
- x /= 2;
- }
- j = 3;
- while (j * j <= x) {
- if (x % j != 0) j += 2;
- else {
- f++;
- x /= j;
- }
- }
- if (x != 1) f++;
- if (fact < f) {
- fact = f;
- max = i;
- }
- }
- printf("%d = ", max);
- while (max >= 4 && max % 2 == 0) {
- printf("2 * ");
- max /= 2;
- }
- j = 3;
- while (j * j <= max) {
- if (max % j != 0) j += 2;
- else {
- printf("%d * ", j);
- max /= j;
- }
- }
- printf("%d\n", max);
- printf("elem: %d\n", fact);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement