New update is available. Click here to update.

Posted: 31 Dec, 2020

Difficulty: Easy

```
Perfect numbers are those numbers that are equal to the sum of all its proper divisors.
Proper divisors are all the divisors of a number excluding the number itself.
```

```
For K = 6, the proper divisors of 6 are 1, 2, 3 and its sum is 6 so 6 is a perfect number. For K = 8, the proper divisors of 8 are 1, 2,4 and its sum is 7 so 8 is not a perfect number.
```

```
The first line of input contains a single integer T, representing the number of test cases.
The first and the only line of each test case contains a single positive integer K, as described in the problem statement.
```

```
For each test case, return true if K is a perfect number or else return false.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
2 <= K <= 10^8
Time Limit: 1 sec
```

```
Can you do this in O(sqrt(N)) time and constant space?
```

SIMILAR PROBLEMS

Print Name

Posted: 20 Apr, 2022

Difficulty: Easy

A Number Game

Posted: 23 Apr, 2022

Difficulty: Moderate

Pair Product Div by K

Posted: 15 May, 2022

Difficulty: Moderate

Pair Product Div by K

Posted: 15 May, 2022

Difficulty: Moderate

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Co-Prime

Posted: 14 Dec, 2022

Difficulty: Hard

Popular Interview Problems: