In a certain town, there are two groups of men - one group always tells the truth; the other group always lies.

A stranger arrived in this town and asked one of the natives whether he was a Truth Teller or a Liar. The native answered but the stranger did not catch it. Two other natives, A and B, who overheard the conversation were questioned by the stranger as to what the first man had said. A replied, "He said he was a Truth Teller." Native B replied, "He said he was a Liar."

Can you tell which of the two men, A or B, is a Truth Teller and which is a Liar?

Program I (Perfect Numbers)

A perfect number is a number that is the sum of its divisors. The divisors of 6 are 1, 2, and 3 and they add up to 6 [1 + 2 + 3 = 6]. Another perfect number is 28. The divisors of 28 are 1, 2, 4, 7, 14 and they add up to 28. There are not many perfect numbers. Write a program that takes as input an integer number and determines if it is perfect or not.

Program II (Palindromic Numbers)

Modify the program that we wrote to find the reverse of a number to find the only non-palindromic number whose cube is palindromic? [Hint: the number is a four-digit number.]

Challenge Program

A software engineer lived on a street that was numbered linearly starting at 1. She had a dog that she used to take out for walks. In the morning she would walk in one direction and in the evening she would walk in the opposite direction. On one of her walks she summed the house numbers in that direction and compared it to the sum of the house numbers in the other direction (not including her house number). To her amazemment she found that the two sums were the same. This was a unique feature of her house and she felt that she lived in a lucky house. So when she moved to another city, she asked her realtor to find her a house with exactly that same feature, i.e. the sum of house numbers on one side is equal to sum of the house numbers on the other side. Your task is to write a program that will help the real estate agent find pairs of numbers (the lucky house and the last house on the street). Assume that there cannot be more than 10,000 houses on a given street. The first set of numbers that have this property is 6 and 8.