Perfect numbers:

```
Select[ Range[10^6], Total[Divisors @ #] == 2 # &]
```

```
{6, 28, 496, 8128}
```

abundant numbers:

```
Select[ Range[10^3], Total[ Most @ Divisors @ #] > # &]//Short
```

```
{ 12, 18, 20, 24, 30, 36, 40, 42, 48, <<228>>,
968, 972, 978, 980, 984, 990, 992, 996, 1000}
```

I used `Short`

to to get only a few since there are:

```
Count[ Range[10^3], _?(Total[Most@Divisors@#] > # &)]
```

```
246
```

of them.

**Edit**

As RunnyKine pointed out that using `DivisorSigma[1, #] &`

is more efficient than `Total @ Divisors @ # &`

. Another improvement might be exploiting the fact that there are no known odd perfect numbers, it was verified that there is none below `10^1500`

. The largest known perfect number (`48`

-th) has only `34850340`

digits i.e. `IntegerLength[2^(57885161 - 1) (2^57885161 - 1)]`

. Taking the above into account we get `2`

times speed up with:

```
Pick[ #, DivisorSigma[1, #] - 2 #, 0]& @ Range[2, 10^6, 2]
```

However we can observe there are odd abundant numbers, but they are sparsely distributed among even ones. Below `1000`

there is only one ( while there are `245`

even ones):

```
Pick[ #, UnitStep[ DivisorSigma[1, #] - 2 # - 1], 1]& @ Range[1, 10^3, 2]
```

```
{945}
```

Below `10^6`

there are

```
Length @ Pick[ #, UnitStep[ DivisorSigma[1, #] - 2 # - 1], 1] & /@
{Range[ 2, 10^6, 2], Range[ 1, 10^6, 2]}
```

```
{245549, 1996}
```

even and odd abundant numbers respectively.

It is remarkable that `Length @ Pick[ Range[10^6], UnitStep[ DivisorSigma[1, #] - 2 # - 1], 1]]`

is faster than : `Count[ Range[10^6], _?(DivisorSigma[1, #] > 2 # &)]`

.

Good stuff. I wonder if there's any odd perfect numbers. – RunnyKine – 2013-10-20T04:05:54.913

@RunnyKine Many have asked this question for centuries. Check out MathWorld or http://www.oddperfect.org/

– KennyColnago – 2013-10-20T17:26:38.860I just started learning this information, but what exactly does @ do? – asik – 2013-10-20T18:27:04.010

@asik

– Artes – 2013-10-20T18:29:49.943`f @ x`

is equivalent to`f[x]`

, another possible form is`x//f`

. Read e.g. Special Ways to Input Expressions tutorial in the documentation.Thank you! Kept seeing it, but I wanted to make sure. – asik – 2013-10-21T03:21:41.053