next up previous
: この文書について...

CSL102: Introduction to Computer Science
II semester 2004-05
Amicable numbers are pairs of distinct positive integers each of whose proper divisors adds up to the other (1 is included as a divisor but the numbers are not included as their own divisors). The smallest pair of amicable numbers is (220, 284).

Down through their quaint history, amicable numbers have been important in magic and astrology, and in casting of horoscopes, making talismans, and concocting love potions. The philosopher Iamblichus of Chalcis (A.D 250 - A.D 330) ascribed a knowledge of the pair 220 and 284 to the Pythagoreans. He wrote: ``They [the Pythagoreans] call certain numbers amicable numbers, adopting virtues and social qualities to numbers, as 220 and 284; for the parts of each have the power to generate the other''.

Develop an SML function amicables which generates all pairs of amicable numbers $ (m,n)$ with $ m < n <$ valOf Int.maxInt.

Note:

  1. You are not allowed to change any of the names given in the signature. You are not even allowed to change upper-case letters to lower-case letters or vice-versa.
  2. You may define any new functions you like in the structure besides those mentioned in the signature.
  3. Your program should work with the given signature.
  4. You need to think of the most efficient way of implementing the various functions given in the signature so that the function results satisfy their definitions and properties.
  5. Since the evaluator is going to look at your source code before evaluating it, you must explain your algorithms in the form of ML comments, so that the evaluator can understand what you have implemented.
  6. Do not add any more decorations or functions or user-interfaces in order to impress the evaluator of the program. Nobody is going to be impressed by it.
  7. There is a serious penalty for copying. If it is felt that there is too much similarity in the code between any two persons, then both are going to be penalized equally. So please set permissions on your directories, so that others cannot copy your programs.



next up previous
: この文書について...
S Arun-Kumar 平成17年1月30日