p^2 - 25 does contain the prime factors 2, 3, but not 5: p - 5 and p + 5 are not divisible by 5 and p^2 - 25 is divisible by 24 as primes are 1 or 2 mod 3 and thus p - 5 or p + 5 are 0 mod 3 and primes are 1 or 3 mod 4 and thus p - 5 or p + 5 are 0 mod 4 and both p - 5 and p + 5 are even.
In general, if p > k is prime and k is odd and not divisible by 3, p^2 - k^2 is divisible by 24.
def A214150(n): return 19 if n == 1 else int(min(filter(lambda n: n > 5 and isprime(n), (crt(tuple(sieve.primerange(7, prime(n+3)+1)), t)[0] for t in product((5, -5), repeat=n))))) # Chai Wah Wu, Jun 01 2022