Max product of $20$ numbers with mean $12$ if $n$-th number is $\frac{n}2$ or $2n$? A list contains $20$ numbers. For each positive integer $n$, from $1$ to $20$, the $n$th number in the list is either $\frac{1}{2}n$ or $2n$. If the mean of the number in the list is exactly $12$ and the product of the numbers is $P$, what is the greatest possible value of $\frac{P}{20!}$?

I have tried some examples, but they bring me nowhere. I then tried creating equations: I can call the sum of the numbers that you are halving by $a$ and the sum of the numbers that you are doubling by $b$. However, after trying repeatedly, I don't see any way to create an equation. Can I have a hint?
Also, if you are nice, may you please help me on this question($N$'s base-5 and base-6 representations, treated as base-10, yield sum $S$. For which $N$ are $S$'s rightmost two digits the same as $2N$'s?)?
Thanks!
Max0815
 A: Suppose, for $m \leq n$ that $m$ is the number of terms in the sequence with the factor of $1/2$.  Then,
$$P = \prod_{n = 1}^{20} n = (\frac{1}{2})^m(2)^{n-m} 20!.$$
Then,
$$\frac{P}{20!} = 2^{n-2m}.$$
To find $m$ and $n$, note that the mean of the sequence is $12$.  We want the mean to be $12$ with $m$ as small as possible.  So, we start by tacking on the factor of $1/2$ onto the largest terms in the sequence.
$$\frac{1}{20}(\sum_{n=1}^{13} 2n + (1/2)*\sum_{n=14}^{20} n) = 9.1+2.975 \approx 12,$$
which is not quite there.
We will need to increase $m$ by one and decrease $n$ by one.  So, I think the answer is
$$2^{20-2*8} = 2^{4} = 16.$$
But I'm not sure how to make the mean exactly $12$.
Anyway, this is how I would go about the problem.
A: This is an extension to the answer provided by D.B. to confirm the stated result.  
Since the mean is $12$, with $20$ numbers, the sum $S$ is such that $S / 20 = 12$, so $S = 240$. Now, for comparison, consider as an upper range that all $20$ values use $2n$, to then get a sum of
$$2\left(1 + 2 + \ldots + 19 + 20\right) = 2\frac{\left(20\right)\left(21\right)}{2} = 420 \tag{1}\label{eq1}$$
As such, this is $420 - 240 = 180$ too high. Now, for each term which used the $n/2$ value instead, it would reduce the sum by $3n/2$. As such, if the sum of these $n$ values is $S_1$, we have that that the total reduction is $3S_1/2 = 180$ giving that $S_1 = 120$. As mentioned, we want the number of these terms to be the minimum, so we start using the largest ones. Using the $7$ values $14, 15, \ldots 20$ gives a sum of $119$, meaning just need to use $1$ as well to get the sum to $120$, for a total of $8$ terms, as conjectured. Note you cannot use $7$ or less since, as just shown, the $7$ largest values add to $119$, so any other $7$ or fewer terms will add up to less than $119$, so $8$ is the minimum # of terms required.
One small thing to note is that which $8$ terms are to use $n/2$ is not uniquely defined. For example, the $1$ and $14$ terms can be replaced by any other $2$ which add to $15$, such as $2$ and $13$, $3$ and $12$, $\ldots$, $7$ and $8$.
