The Ljung-Box test (named for Greta M. Ljung and George E. P. Box) is a portmanteau test for autocorrelated errors.
A portmanteau test tests whether any of a group of autocorrelations of a time series are different from zero.
The Ljung-Box statistic is better for all sample sizes including small ones.
The Box-Pierce test statistic is a simplified version of the Ljung-Box statistic
for which subsequent simulation studies have shown poor performance.
The R equivalent function is Box.test.