We are asked to find the greatest value of \( n \) such that \( 3^n \) divides \( 50! \).
The number of times a prime \( p \) divides \( n! \) is given by the formula:
\[
\sum_{k=1}^{\infty} \left\lfloor \frac{n}{p^k} \right\rfloor
\]
where \( \left\lfloor x \right\rfloor \) denotes the greatest integer less than or equal to \( x \).
In this case, \( p = 3 \) and \( n = 50 \). So, we need to find:
\[
\sum_{k=1}^{\infty} \left\lfloor \frac{50}{3^k} \right\rfloor
\]
Step 1: Calculate the individual terms.
For \( k = 1 \):
\[
\left\lfloor \frac{50}{3} \right\rfloor = \left\lfloor 16.67 \right\rfloor = 16
\]
For \( k = 2 \):
\[
\left\lfloor \frac{50}{9} \right\rfloor = \left\lfloor 5.56 \right\rfloor = 5
\]
For \( k = 3 \):
\[
\left\lfloor \frac{50}{27} \right\rfloor = \left\lfloor 1.85 \right\rfloor = 1
\]
For \( k = 4 \):
\[
\left\lfloor \frac{50}{81} \right\rfloor = \left\lfloor 0.62 \right\rfloor = 0
\]
Since higher powers of 3 will not divide 50, we stop here.
Step 2: Add the results.
\[
16 + 5 + 1 = 22
\]
Thus, the greatest value of \( n \) such that \( 3^n \) divides \( 50! \) is \( 22 \).