Of course it misses primes.
In these cases, it helps to know WHY things work.
All primes (except for 2 and 3) are of the form “6k +/- 1” because 2 and 3 are prime (which is why they are the exception).
So, 6k, 6k+2 and 6k-2 are all divisible by 2. 6k+3 is divisible by 3. That only leaves 6k+1 and 6k-1, which are the only numbers that can be (but are not always) prime. If they are not prime, they are divisible by a prime larger than 3. For example, 25 is 64+1 and divisible by 5 (larger than 3). And 35 is 66 - 1 and divisible by 5 and 7 (both primes larger than 3).
If we extend this notion, we actually go up to 30k (not 24k) +/- various values, because the next largest prime after 2 and 3 is 5.
From that list, we can eliminate 30k+any even number (divisible by 2). Likewise, we can eliminate 30k+{3,9,15,21,27} because they are divisible by 3. Further, we can eliminate 30k+{5,25} because they are divisible by 5.
That leaves 30k+/-1, 30k+/-7, 30k+/-11, 30k+/-13.
So, all primes larger than 5 can be expressed in one of the forms {30k+/-1, 30k+/-7, 30k+/- 11, 30k+/-13}.
Notice that any of these primes can also be expressed in the form 6k+/- 1.
For example:
30k+1 = 6*(5k) + 1 = 6*m + 1.
30k+7 = 6*(5k) + 6 + 1 = 6*(5k+1) + 1 = 6*n + 1
30k + 11 = 6*(5k) + 12 - 1 = 6*(5k +2) - 1 = 6*p - 1
30k + 13 = 6*(5k) + 12 + 1 = 6*(5k + 2) + 1 = 6*p + 1
I know that 8 possibilities is not as exciting or concise as 6k+/-1, but that’s where the math takes you.
Naturally, we can extend this further (the next step would be 210k+/- m), but it becomes a much less useful guide at that point.
BTW: this is NOT a particularly good way of detecting primes. It’s a good way for detecting COMPOSITES. If you have a prime candidate, you still have to determine whether or not it is divisible by a smaller number. For example, if a number can be expressed as 6k+3, you automatically know it’s NOT prime. But if a number is of the form 6k+1, it might be prime or composite. You still have to do more checking to determine primality.