P27789 [洛谷] Find Perfect Numbers Between 2 and n
普及-
题目描述

Problem Description

Find all perfect numbers between the positive integers $2$ and $n$ (output one number per line).

A perfect number is a natural number for which the sum of all its smaller divisors equals itself. For example, $6 = 1 + 2 + 3$.

Input Format

Input consists of an integer $n$ where $n \le 10000$.

Output Format

Output each perfect number on a new line in ascending order.

Sample Input and Output

Sample Input #1

10

Sample Output #1

6

Sample Input #2

100

Sample Output #2

6
28
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10
样例输出
6