Java - Mersenne Prime assignment
<p>the assignment is to find all Mersenne primes with p &lt;= 31 and display in a table:</p>

<pre><code>p     2^p-1
---   ---- 
2      3

3      7

5      31

...
</code></pre>

<p>My result so far is this code:</p>

<pre><code>public class PE28MersennePrimeVer2 {

    public static void main(String[] args) {

        System.out.println("p\t2^p - 1");

        for (int number = 2; number &lt;= 31; number++) {
            if (isPrime(number)) {
                int mersennePrime = (int)(Math.pow(2, number)) - 1;
                if (isPrime(mersennePrime)) {
                    System.out.print(number + "\t" + mersennePrime + "\n");
                }
            }
        }
    }

    public static boolean isPrime(int number) {

        if ((number == 1) || (number == 2)) {
            return true;
        }

        for (int i = 2; i &lt;= number/2; i++) {
            if (number % i == 0) {
                return false;
            }
        }

        return true;
    }
}
</code></pre>

<p>The output is for p up to 19, never reach 31. What I'm doing wrong?</p>
