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$
 A: Only if $p$ is prime.
Let's see counterexamples to this, to

*

*$n \vert ab \Longrightarrow n \vert a \vee n \vert b.$
If $n = ab,$ then $ab \not \vert a$ and $ab \not \vert b.$ The property works for primes because the prime factors cannot be split into further non 1 prime factors.

*

*$n \vert a^k \Longrightarrow n \vert a.$ This is not true: suppose $k > 2$ and $n = a^2.$ It follows that this doesn't hold.

A: $6|6=2\cdot 3$, but $6$ divides neither $3$ nor $2$.
A: You make the claim that $p\not\mid a_k \iff \gcd(p, a_k) = 1$.
That's clearly false.  Consider $6\not \mid 14$ but $\gcd(6, 14) =2$.
.... The gyst of the statement (which is called Euclid's lemma) is that all numbers are composed of indivisible prime "atoms".  If $n|a\cdot b\cdot c$ then the prime atoms of $n$ may be spread across $a,b,$ and $c$ but each individual atom must belong to one of $a,b$ or $c$.
So the statement isn't true.  $6|24 = 3\cdot 8$ but $6\not \mid 3$ and $6\not \mid 8$.  But the prime atoms of $6$ are $2$ and $3$.  The $2$ atom is contained in the $8$.  And the $3$ atom is contained in the $3$.
So the question is to prove that if $p$ is prime and $p|\prod a_k$ prove that because $p$ can't "be broken up" that it can't be "spread" between $a$ and $b$ that it must divide and be "contained" entirely in either the $a$ or the $b$.
.....
Note:  $n\not \mid b \iff \gcd(n,b)=1$ is clearly false because $n$ can have some $\gcd(n,b) = d$ and $d|b$ but $n$ could have some "extra atoms" that $b$ doesn't share so we could have $\frac nd\not \mid b$.
But if $p$ is prime then $p\not \mid b \iff \gcd(p,b)$ is true because if $\gcd(p, b) \ne 1$ then $p$ and $b$ share some prime atoms in common.  But $p$ itself is a prime atom so the only atom they have in common is $p$ and $p|b$.
So.... formalize and prove that as a Lemma:

Lemma: If $p$ is prime then $p\not \mid b \iff \gcd(p,b) = 1$.

Then your proof will be better. (there's actually a problem in that you proof assumes that there is only one set of $a_1,....a_k$ whose product is the number.  You must assume it is true for every possible set of $k$ numbers and every possible product.)
Hint:  It might be easier to prove a stronger more detailed lemma:

Strong Lemma:  If $p$ is prime then for any integer $b$ either $\gcd(p,b) = 1$ and $p\not \mid b$, or $\gcd(p,b) = p$ and $p \mid b$.  No other option exists.

