# Beauty of Numbers

Many students in some class or either might have been interested in Number theory as it is so much fun in solving those riddles.Here we present two problems to refresh your skills. Hope you will love them.And yea the difference is that you may not have learnt computer programming back then but you know some computer programming now so you can use the computer :) and program the task.

## Problem 1:

A number is called perfect, if the sum of all its proper divisors is the number itself. Write a program to test, whether a given number is perfect or not. The first perfect number is 6, because 1, 2, and 3 are its proper positive divisors and 1 + 2 + 3 = 6.

Input Specification

Input contains a single positive integer(< 1010). Use long long for the number.

Output Specification

Output "YES" or "NO" (quotes for clarity) corresponding to whether the number in input is perfect or not.

Sample Input and Output

Input: 28
Output: YES
Input: 16
Output: NO

## Problem 2:

Interestingly, every positive rational number can be expressed in the form q + 1/E. where q is a non-negative integer and E is either the number 1 or an expression of the same form as above. We call such an expression a continued fraction. For eg., 239/51 is equivalent to 239/51 = 4 + 1/(1+(1/2+(1/(5+1/(2+(1/1)))))) Write a program which takes two integers (eg. 239 and 51) and output a set of integers (eg. 4 1 2 5 2 ) which are the sequence of q's until E becomes 1. For another example for 27 and 10 Output 2 1 2 2.

Input Specification

Input contains 2 positive integers separated by a space.

Output Specification

Output a set of integers which are the sequence of q's until E becomes 1, the set of integers must be separated by spaces.

Sample Input and Output

Input: 239 51
Output: 4 1 2 5 2
Input: 27 10
Output: 2 1 2 2