Calculating the variance of dice rolls? I am having trouble understanding how to find the variance for the proportion of times we see a 6 when we roll a dice.  The question is below:
Suppose we are interested in the proportion of times we see a 6 when
rolling n=100 dice. This is a random variable which we can simulate with
x=sample(1:6, n, replace=TRUE) 

and the proportion we are interested in can be expressed as an average:
mean(x==6)

Because the die rolls are independent, the CLT applies. We want to roll n dice 10,000 times and keep these proportions. This
random variable (proportion of 6s) has mean p=1/6 and variance p*(1-p)/n.  So according to the CLT, z = (mean(x==6) - p) / sqrt(p*(1-p)/n) should  be normal with mean 0 and SD 1.
So according to the problem, the mean proportion you should get is 1/6. I  can get how the proportion of 6's you get should average out to 1/6. The mean proportion is p = 1/6.
But the variance confuses me. The question says variance is p*(1-p)/n. But the formula for variance for a sample is the sum of the difference between a value and the mean divided by the sample size minus one.  Why do they do differently here?
 A: Let's call $x$ the number of 6's in $n$ die rolls. The theoretical variance for the number of 6's in $N$ die rolls is then $var(x|N=n)=np(1-p)$.
Now let's call $\pi$ the proportion of die rolls which are 6's. Then $E(\pi|N=n)=\frac{x}{n}$. The variance for the proportion of 6's is $var(\pi|N=n)=var(\frac{x}{n}|N=n)=\frac{1}{n^2}var(x|N=n)=\frac{p(1-p)}{n}$.
That is fine for theoretical values; however, now let's say you want to gather some data (or simulate) and estimate $var(\frac{x}{n}|N=n)$ from your data. In that case, you need to account for also estimating the mean. While you could assume the mean is 1/6, perhaps this die is biased and so $P(6)\neq 1/6$.
Since you have to estimate the mean, you effectively use up one of your data points: if you gave me $n-1$ observations and the mean, I know the $n$-th observation. (Thus that $n$-th observation is not independent after using the estimated mean.) We say that the degrees of freedom is $n-1$. For this reason, when you estimate your sample variance you divide the sum of squared differences from the mean by $n-1$.
A: 
But the variance confuses me. The question says variance is p*(1-p)/n.
But the formula for variance for a sample is the sum of the difference
between a value and the mean divided by the sample size minus one. Why
do they do differently here?

That is the sample variance, i.e.
$$\hat\sigma^2=\frac{1}{n-1}\sum_{i=1}^n (x_i-\bar x)^2$$
For a random sample of $x_i$.
