For each of the three questions, make sure your program doesn't get an into infinite loop. It's an interesting theorem from number theory that every natural number can be expressed as the sum of four or fewer squares. N and M returns all the integers between them in succession. Each month one of the countries can choose to dismantle one military division while the other can dismantle two. Each division has a certain strength, and both sides want to make sure that the total military strength remains equal at each point during the disarmament process.
Solution is a list describing the successive dismantlements.
Of course, we assume that the given countries have the same strength to start with, i.e. the sum of Adivisions equals that of Bdivisions. A's dismantlements and the second is a list of country B's dismantlements. Finally, the countries want to start with small dismantlements first in order to build confidence, so make sure that the total strength of one month's dismantlement is less than or equal to the total strength of next month's dismantlement. You can assume that the input lists to your programs are in increasing order. Part 3 Implement a bottom-up approach to logic programming.