Is this property true for all $p$ or for all primes? In my textbook the following property is stated:

Let $p$ be a prime number. For any $a_1,...,a_k\in \mathbb Z$ we have that:
$$p|a_1...a_k \implies \exists i\in\{1,...,k\}:p|a_i$$
In particular, for any $a,b \in \mathbb Z$:

*

*$p|ab \implies (p|a \vee p|b)$

*$p|a^k \implies p|a$

I was able to prove this for but, In my proof, I never used the fact that $p$ is prime. Because of this, I don't know if my proof is valid but this got me wondering: Is this property also valid for any $p$ or only if $p$ is prime?
Edit: I'll show the proof I made for this.

Let $p$ be a prime number and $a_1,...,a_k \in \mathbb Z$ such that:
$$p|\prod_{n=1}^k a_n$$
The proof is by contradiction. Let's assume that $\forall i \in \{1,...,k\}, p \not | a_i$
Now, let's use mathematical induction:

*

*$p \not | a_1$

*Now let's assume that $p \not | \prod_{n=1}^{k-1} a_n$:

We have that $p \not | a_k \iff \gcd(p,a_k) = 1$ and $p \not | \prod_{n=1}^{k-1} a_n \iff \gcd(p,\prod_{n=1}^{k-1} a_n)=1$.
Since $\gcd(p,\prod_{n=1}^{k-1} a_n)=1$ and $\gcd(p,a_k) = 1$ we conclude that: $\gcd(p,a_k \cdot \prod_{n=1}^{k-1} a_n)=1 \iff p \not | \prod_{n=1}^{k} a_n$
This is a contradiction, hence $\exists i \in \{1,...,k\}: p | a_i$

$6|6=2\cdot 3$, but $6$ divides neither $3$ nor $2$.
