Prove that if p is a prime number and p is not equal to 3, then 3 divides p^2 + 2. (Hint: When p is divided by 3, the remainder is either 0,1, or 2. That is, for some integer k, p = 3k or p = 3k + 1 or p = 3k + 2.)

I thought you might do three cases with the three values of p in the hint, plugging them into p^2+2. In two of the cases you get a p^2+2=3a (a some integer) form but for p=3k you do not. Am I approaching this wrong?

The third case is the simplest, because

3|3k
so you're done!

On the other hand, since it is a prime ≠ 3, so in fact, the third case does not even arise.

NO

Your initial approach is on the right track! The hint provided gives you three cases to consider based on the remainder when p is divided by 3. Let's go through each case and see what happens when we plug them into p^2 + 2.

Case 1: p = 3k for some integer k. In this case, substituting p into p^2 + 2 gives (3k)^2 + 2. Expanding this expression, we get 9k^2 + 2. Since 9k^2 is divisible by 3 (since 9 is divisible by 3), we can rewrite this expression as 3(3k^2) + 2. Notice that we have expressed p^2 + 2 in the form of 3a for some integer a (specifically, a = 3k^2). Therefore, when p = 3k, p^2 + 2 is divisible by 3.

Case 2: p = 3k + 1 for some integer k. Substituting p into p^2 + 2 gives (3k + 1)^2 + 2. Expanding and simplifying this expression, we get 9k^2 + 6k + 3. Notice that 9k^2 + 6k is divisible by 3 (since both 9k^2 and 6k are divisible by 3). Therefore, we can rewrite p^2 + 2 as 3(3k^2 + 2k + 1) + 1. Again, we have expressed p^2 + 2 in the form of 3a for some integer a (specifically, a = 3k^2 + 2k + 1). Hence, when p = 3k + 1, p^2 + 2 is divisible by 3.

Case 3: p = 3k + 2 for some integer k. Substituting p into p^2 + 2 gives (3k + 2)^2 + 2. Expanding and simplifying this expression, we get 9k^2 + 12k + 6. Notice that 9k^2 + 12k is divisible by 3 (since both 9k^2 and 12k are divisible by 3). Therefore, we can rewrite p^2 + 2 as 3(3k^2 + 4k + 2) + 2. In this case, we haven't expressed p^2 + 2 in the form of 3a for some integer a. However, we can still see that p^2 + 2 is a multiple of 3 since it is of the form 3b + 2, where b = 3k^2 + 4k + 2. Hence, when p = 3k + 2, p^2 + 2 is divisible by 3.

In all three cases, we have shown that if p is a prime number and p is not equal to 3, then 3 divides p^2 + 2.