What is the greatest $4$-digit integer for which the sum of its proper divisors is $n-1$ 
What is the greatest  $4$-digit integer $n$ for which the sum of its proper divisors is $n-1$?

I can't think of a way to solve this without guessing and checking.
Edit: It is easy to show that all powers of $2$ are such numbers. But are they the only numbers?
 A: What is the definition of "proper divisor" of $n$ ? Like proper subgroup, or proper ideal, I think it can also mean that $1$ and $n$ are not proper. In that case we look for the largest positive integer $n<10000$ with $\sigma(n)=(n-1)+1+n=2n$, hence for a perfect number less that $10^4$. This is $n=8128$.
In case, $\sigma(n)=2n-1$, $n$ is called almost perfect. The only known almost perfect numbers are the powers of $2$. It is not known whether there are others, see the link. So then the answer is, as already remarked, $n=8192$.
A: I get $8192$. This is also $2^{13}$, which I'm sure is significant. I was lazy and programmed it. Its divisors are 1,2,4,8,16,32,64,128,256,512,1024,2048,4096.
using System;

class Program
{
static void Main()
{

    int result = 9999;

    for (int i = 9999; i >= 1000; i--)
    {
        if (SumOfDivisors(i) == i - 1)
        {
            result = i;
            break;
        }
    }

    Console.WriteLine(result);
    Console.ReadKey();
}

//Sums the proper divisors of n
static int SumOfDivisors(int n)
{
    int sum = 0;
    for (int i = 1; i <= n / 2; i++)
    {
        if (n % i == 0) sum += i;
    }
    return sum;
}
}

