Im trying to write a program that will generate the first 5 amicable pairs. When I run my program, it just generates 1 pair and the pair that it gives me is wrong. It gives me 221 and 330. The first pair should be 220 and 284. So I know somewhere in my equations something is wrong. I cant figure out what it is and I keep going over it and writing it down on paper but I get stuck. Could someone point me in the right direction?

Code:#include<iostream> using namespace std; int main() { int Answer; int Answer2; int Remainder; int Remainder2; int Sum1; int Sum2; int D; int F; Answer = 220; Sum1 = 0; D = 1; Sum2 = 0; F = 1; while(Answer <= 7000){ D = Answer / 2; Remainder = Answer % D; if(Remainder == 0){ Sum1 = Sum1 + D; } D++; if(Sum1 > Answer){ Answer2 = Sum1; F = Answer2 / 2; Remainder2 = Answer2 % F; if(Remainder2 == 0){ Sum2 = Sum2 + F; } if(Sum2 == Answer2){ cout << Answer << " and " << Answer2 << " are amicable pairs.\n" << endl; } F++; Answer = Answer + 1; } } return 0; }