The Ljung-Box test statistic $Q$ is defined as $$ Q := n(n+2) \sum_{j=1}^{\ell} \frac{\hat{r}_{j}^2}{n-j}, $$ where $\ell$ is the number of lags and $$ \hat{r}_{j} := \frac{1}{\left\|a \right\|_{2}^2} \sum_{i=j}^{n-1} a_{i}a_{i-j} $$ (This is equation (1.1) of Ljung and Box's "On a Measure of Lack of Fit of Time Series Models"; it's available for free if you search through scholar.google.com, but I can't link to it because the url has a bizarre unique token!)
Ok, let's take $a = (1,2)$ and $\ell =1$. Then $\hat{r}_1 = 2/5$, $\hat{r}_1^2 = 4/25$, and so $Q = 32/25$. Trivial, correct? But I do this calculation in R:
> x <- c(1,2)
> b = Box.test(x, lag=1, "Ljung", fitdf=0)
> b$statistic
2
So R says my super basic calculation is wrong! Does R use a modified definition of the Ljung-Box statistic, or have I made a trivial mistake?
Note: Mathematica agrees with R:
data = {1,2};
H = AutocorrelationTest[data, 1, "HypothesisTestData"];
H["TestStatistic", "LjungBox"]
2