We will call a positive integer nasty
if it has at least two pairs of positive integer factors such that the difference of one pair equals the sum of the other pair.
For example, is nasty since ; and is also nasty since .
Write a program which accepts as input a list of positive integers and determines if each one is nasty or not.
Input Specification
The input is a list of positive integers, one per line. The first number in the list is the number of integers to be tested, and is at most . The integers to be tested are all less than .
Output Specification
The output should contain one line for each test value. Each line is to contain the test value and whether or not it is nasty.
Sample Input
4
6
24
30420
10078
Sample Output
6 is nasty
24 is nasty
30420 is nasty
10078 is not nasty
Comments
This problem only allows the pair if , , and .
Make sure you do not interpret the conditions as , , is a factor, and is a factor.