Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<vector>
- #include <cmath>
- using namespace std;
- int main()
- {
- int c = 0, count_simp = 0, sum = 0;
- for (int i = 499999; i > 0; i--)
- {
- for (int j = 2; j < i; j++)
- {
- if (i % j == 0)
- {
- for (int k = 1; k < j; k++)
- {
- if (j % k == 0)
- {
- count_simp++;
- }
- }
- }
- if (count_simp == 1)
- {
- sum += j;
- }
- count_simp = 0;
- }
- if (sum % 10 == 0 && sum > 0)
- {
- cout << i << " " << sum << endl;
- c++;
- }
- if (c == 7)
- {
- break;
- }
- sum = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement