Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int isPrime(int n)
- {
- if (n < 2) return 0;
- int i, sqrt_n = sqrt(n);
- for (i=2; i<=sqrt_n; i++) if (n%i == 0) return 0;
- return 1;
- }
- int main()
- {
- int a, b, n, max = 0, product;
- for (a = -999; a < 1000; a++)
- {
- for (b = -999; b < 1000; b++)
- {
- for (n=0; isPrime(n*n+a*n+b); n++);
- if (n > max) max = n, product = a*b;
- }
- }
- printf("%d\n",product);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement