Proving functional relationships between primes Given $n \in \mathbb{N}$ and a function $f(n)$ :
$$
f(n) = \dfrac{4^n - 1}{3}
$$
If P is the set of prime divisors of $f(n)$, prove that for all $n$ there exists $Q \subset P$, such that if:
$$
Q = \{ q_1,q_2, \dots ,q_r \}
$$
$$
P \cap \overline{Q} = \{ p_1,p_2, \dots ,p_s \}
$$
Then :
$$
2(-1)^n + 3 \prod_{i=1}^{r} q_i  = \prod_{j = 1}^{s} p_j
$$
For example, for $n = 8$ I find:
$$
f(n) = \dfrac{4^8 - 1}{3} = 21845
$$
$$
P = \{ 5, 17, 257 \} ,\hspace{3mm} Q = \{ 5, 17 \},\hspace{3mm} P \cap \overline{Q} = \{ 257 \}
$$
$$
\downarrow
$$
$$
2(-1)^{8} + 3(5 \times 17) = 257
$$
How should I approach something like this? I have went through several cases and failed to spot how to attack this,  I see it might potentially have some relation to Mersenne primes, but I am not sure how.
 A: Factoring the numerator gives
$$4^n - 1 = (2^2)^n - 1 = (2^n)^2 - 1 = (2^n - 1)(2^n + 1) \tag{1}\label{eq1A}$$
With $2^n - 1$ and $2^n + 1$ being odd and just $2$ apart giving $\gcd(2^n - 1, 2^n + 1) = 1$, the sets of prime factors of $2^n - 1$ and $2^n + 1$ are distinct. Next, consider the $2$ cases of the parity of $n$.
With $n$ being even, then for some $j \in \mathbb{N}$,
$$3 \mid 2^n - 1 \implies 2^n - 1 = 3j \implies f(n) = j(2^n + 1) \tag{2}\label{eq2A}$$
Have $Q$ be the prime factors of $j$, which means $P \cap \overline{Q}$ are the prime factors of $2^n + 1$. This gives
$$\begin{equation}\begin{aligned}
2(-1)^n + 3\prod_{i=1}^{r}q_i & = 2 + 3j \\
& = 2 + (2^n - 1) \\
& = 2^n + 1 \\
& = \prod_{i=1}^{s}p_i
\end{aligned}\end{equation}\tag{3}\label{eq3A}$$
Your example of $n = 4$ gives $j = \frac{4^4 - 1}{3} = 85 = 5 \times 17$, so $Q = \{5, 17\}$, with $4^4 + 1 = 257$ giving $P \cap \overline{Q} = \{257\}$.
The handling for odd $n$ is similar, with $3 \mid 2^n + 1$ instead, which I'll leave to you to do.

One small thing regarding the question itself is that sets don't normally include duplicate values. Thus, apart from cases where $3^2$ is a factor of one term so it becomes just $3$ in $f(n)$, since some $f(n)$ have prime factors of multiplicity greater than $1$ (e.g., for $n = 9$ and $n = 10$, $f(n)$ has $3$ and $5$, respectively, as dvd280's comment points out), I believe that multiset was the intended proper term to be used instead.
Also note that a shorter, alternative way to have written the question so it didn't involve sets (or multisets) of prime factors is for it to have asked to prove there's a $q, r \in \mathbb{N}$ where $f(n) = qr$ and $2(-1)^n + 3q = r$.
