I asked this question on puzzling.se and someone suggested I post it here:

I discovered this by accident, when trying to create a formula that generates prime numbers (an impossible task, I know).

But, I find it very interesting that you take any prime number 5 and greater, then you square it and subtract 1, dividing it by 24 always results in a whole integer.

For example:

```
5 x 5 = 25 - 1 = 24 / 24 = 1
7 x 7 = 49 - 1 = 48 / 24 = 2
11 x 11 = 121 - 1 = 120 / 24 = 50
```

The result is always a whole number, regardless of how high the prime number is.

Can someone explain why this is so, mathematically? This does not seem possible (to me). And if this is really true, why can I find nothing written about it?

I have never heard of this theorem before, and nothing is mentioned on Wikipedia or other sources. But perhaps this could be a helpful in reducing $33\%$ of the possibilities when trying to find or prove large prime numbers, computationally.

UPDATE: lab made the observation that all resulting numbers are apparently also divisible by $24$ .. interesting

UPDATE: following lab's observation , I tried $24 \times 24 = 576 + 1 = 577$ ( a prime number) .. interesting and.. $576 \times 576 + 1 = 331,777$ which is also a prime

Further extrapolating in the gap of numbers between $2$ and $50$:

primes:

```
24 x 3 = 72 + 1 = 73 72 - 1 = 71 72 + 7 = 79
24 x 4 = 96 + 1 = 97 96 + 5 = 101 96 + 7 = 103
24 x 5 = 120 - 7 = 113 120 + 7 = 121
24 x 6 = 144 - 7 = 137 144 + 7 = 151
24 x 7 = 168 - 1 = 167 168 + 5 = 173
24 x 8 = 192 - 1 = 191 192 + 5 = 197
24 x 9 = 216 + 7 = 223
```

Not a perfect formula for finding primes, but seems to be effective :-)