p^2-1 = (p-1)(p+1) where p is a prime > 3. p-1 and p+1 are both guaranteed to be even, and since they're consecutive even numbers, one is also a multiple of 4, making (p-1)(p+1) a multiple of 8. In addition, since p-1, p and p+1 are consecutive numbers, one of them is a multiple of 3. We know it's not p since it's prime, so one of p-1 or p+1 is a multiple of 3.
Thus (p-1)(p+1) is both a multiple of 8 and 3, and since those numbers are relatively prime, the product is a multiple of 24.
p^2-1 = (p-1)(p+1) where p is a prime > 3. p-1 and p+1 are both guaranteed to be even, and since they're consecutive even numbers, one is also a multiple of 4, making (p-1)(p+1) a multiple of 8. In addition, since p-1, p and p+1 are consecutive numbers, one of them is a multiple of 3. We know it's not p since it's prime, so one of p-1 or p+1 is a multiple of 3.
Thus (p-1)(p+1) is both a multiple of 8 and 3, and since those numbers are relatively prime, the product is a multiple of 24.