Randomness is a central concept to statistics and physics. Here, we conduct experimental investigations with a coin toss and prime number to show experimental evidence that tossing coins and finding last digits of prime numbers are statistically identical with respect to equally likely outcomes. The range of frequency of an outcome (*R*) is normalized by the total number of repetitions (*N*) to be the range of relative frequency (*R*/*N*). We find that *R*/*N* has a power-law scaling *R*/*N* ∼ *N*^{−0.6}, which is valid for large numbers in both cases of a coin toss and the last digit of a prime number. This analysis, indicating *R*/*N* → 0 at *N* → ∞, confirms that randomness and equally likely outcomes can be valid for large numbers.

## I. INTRODUCTION

Randomness is essential in statistics as well as in making a fair decision^{1–4} and in making pseudorandom numbers.^{5,6} Coin tossing is a basic example of a random phenomenon:^{2} by flipping a coin, one believes to randomly choose between heads and tails. Coin tossing is a simple and fair way of deciding between two arbitrary options.^{3} It is commonly assumed that coin tossing is random. For a fair coin, the probability of heads and tails is equal, i.e., prob(heads) = prob(tails) = 50%. This situation is valid only under a condition that all possible orientations of the coin are equally likely.^{4} In fact, real coins spin in three dimensions and have finite thickness, so coin tossing is a physical phenomenon governed by Newtonian mechanics.^{1–4} Making a choice by flipping a coin is still important in quantum mechanical statistics.^{6,7} The randomness in coin tossing or rolling a dice is of great interest in physics and statistics:^{8–13} coin or dice tossing is commonly believed to be random but can be chaotic in the real world.^{14}

A similar situation appears in distribution of last digits in prime numbers. Prime numbers are positive integers larger than 1; they are divisible only by 1 and themselves. All primes except 2 and 5 should end in a last digit (*j*) of 1, 3, 7, or 9. In mathematics, the last digits are believed (without a proof) to be random or evenly distributed when numbers are large enough.^{15} If the last digits of prime numbers come out with the same frequency, then the probability of the four last digits would be equal, i.e., prob(*j*) = 25%. The study of the distribution of prime numbers has fascinated mathematicians and physicists for many centuries.^{15–19} The distribution of prime numbers is essential to mathematics as well as physics and biology. Particularly in many disparate natural datasets and mathematical sequences, the leading digit (*d*) is not uniformly distributed but instead has a biased probability *P*(*d*) = log_{10}(1 + 1/*d*) with *d* = 1, 2, …, 9, known as Benford’s law.^{16–18} The distribution of last digits of prime numbers is another important topic; in particular, it is unclear that the four last digits are random or evenly distributed when numbers are large enough.

In this article, we present the experimental proof achieved from a coin toss and prime number to support the validity of randomness for large numbers. The experimental evidence indicates that tossing coins and finding last digits of primes are intrinsically *identical* in statistics with respect to equally likely outcomes. This analysis confirms that randomness can be valid only for large numbers.

## II. ANALYSIS METHOD

There are many examples for equally likely outcomes; representatively, coin tossing is believed to occur with a probability of 50% between heads and tails. For repeated experiments with the same sample, if its frequency between expected outcomes is equal, one can say the expected outcome of the sample is *random*. Here, we suggest a simple way to define the randomness concerning equally likely outcomes for large numbers.

The frequency of each outcome (*n*_{i}) can vary complicatedly according to experiments and conditions. The relative frequency of an outcome (*f*_{i}) is calculated by dividing *n*_{i} by the total number of repetitions (*N* or equally the size of the sample). The range of frequency (*R*) is defined as the difference between the maximum frequency ($nimax$) and the minimum frequency ($nimin$), consequently described as $R=(nimax\u2212nimin)$. In statistics, it is well known that the range of frequency (*R*) tends to be larger for a larger size of the sample (*N*).^{20,21} This tendency can be described by a power-law scaling *R* ∼ *N*^{α}, where 0 < *α* < 1. Such a power-law scaling commonly appears in statistics and physics.^{22,23} Additionally, the range of relative frequency (*R*/*N*) between equally likely outcomes is defined as $R/N=(fimax\u2212fimin)$, which is equivalent to $(nimax\u2212nimin)/N$. From *R* ∼ *N*^{α}, *R*/*N* should have a simple power-law relation *R*/*N* ∼ *N*^{β}, where *β* = *α* − 1 (note that *β* < 0 because *α* < 1). The statistical expectation of *R*/*N* ∼ *N*^{β} (*β* < 0) implies that the frequency of each outcome should become equal (because *R*/*N* → 0) as the total number of repetitions increases (*N* → ∞). Consequently, the condition *R*/*N* → 0 at *N* → ∞ explains why randomness is valid only for large numbers, which is known as the law of large numbers in probability theory. In this study, we would like to assume the *β* exponents to be approximately −0.6 in coin tosses (with two equal outcomes) and last digits of prime numbers (with four equal outcomes) with respect to equally likely outcomes.

## III. RESULTS AND DISCUSSION

First, we conducted an analysis with coin tossing, as shown in Fig. 1. To rule out physical and mechanical aspects of tossed coins, we used an online virtual coin toss simulation application (http://www.virtualcointoss.com) with an ideal coin of zero thickness, where there is no bias between heads and tails, ensuring equal probabilities for heads and tails. Our experiments with perfectly thin coins enable us to consider only the statistical features of coin-tossing problems. We carried out five experiments separately. The frequency of heads (*n*_{H}) or tails (*n*_{T}) for each experiment was recorded with the number of tosses (*N*) (equally the size of the sample). The relative frequencies (*f*_{H} = *n*_{H}/*N* or *f*_{T} = *n*_{T}/*N* for heads or tails), the range of frequency [$R=(nimax\u2212nimin)$, where *i* = heads or tails], and the range of relative frequency [$R/N=(nimax\u2212nimin)/N$] were summarized in Tables S1–S5 of the supplementary material. Each of experiments was illustrated with a different color.

In turn, we examined the last digits of prime numbers, as illustrated in Fig. 2. As well known, all prime numbers except 2 and 5 should end in a last digit (1, 3, 7, or 9), and the last digits are expected to be random when numbers are large enough, which suggests that the frequency of the four last digits should be equal, i.e., prob(*j*) = 25%. For the prime numbers in base 10 for integers up to 10^{7} (where a total of 664 579 prime numbers exist), we calculated the frequency of each last digit (*n*_{j}, where *j* = 1, 3, 7, or 9), the range of frequency [$R=(njmax\u2212njmin)$], and the range of relative frequency [$R/N=(njmax\u2212njmin)/N$], as summarized in Table S6 of the supplementary material. Here, the number of prime numbers (*N*) (including 2 and 5) is equivalent to the size of the sample.

Statistical uncertainties were checked for coin tossing experiments in the plot of *R*/*N* with *N* [Fig. 3(a)] by measuring one standard deviation from five experiments (from five data points for *R*/*N* for a given *N*). However, the prime numbers and the range of relative frequency were completely deterministic for integer numbers up to 10^{7}, which implies no errors in the plot of *R*/*N* with *N* [Fig. 3(b)].

For coin tosses, the relative frequency of heads for five experiments up to 10^{4} repetitions differently varies for small numbers but converges at the expected value [prob(*i*) = 50%, where *i* = heads or tails] for large numbers [toward the dashed lines, as shown in Fig. 1(b)], which supports the fact that coin tossing is a problem of equally likely outcomes. The well-known statistical feature that the range (*R*) tends to be larger for a larger size of the sample (*N*) suggests a power-law scaling *R* ∼ *N*^{α} (0 < *α* < 1). On this basis, we expected a simple relation for the range of relative frequency for heads and tails given by $R/N=(nimax\u2212nimin)/N$ as *R*/*N* ∼ *N*^{β}, where *β* = *α* − 1 < 0. As illustrated in Fig. 3(a), *R*/*N* = 3.1461*N*^{−0.6237} for the trend line; we obtained *β* = −0.6237 (the standard error = ±0.0272) for five coin tossing experiments (error bars resulting from one standard deviation). This result clearly supports the validity of prob(*i*) = 50% by *R*/*N* → 0 at *N* → ∞, indicating statistical evidence of randomness for coin tosses at large numbers, which is consistent with a common belief about coin tossing.^{9}

For last digits of prime numbers, the relative frequency of last digits finally approaches to the ultimately expected value [prob(*j*) = 25%, where *j* = 1, 3, 7, or 9] [toward the dashed lines, as shown in Fig. 2(b)]. The range of frequency among last digits increases with the total number of primes as a power-law scaling of *R* ∼ *N*^{α} with *α* ≈ 0.4, which is similar to the case of coin tossing. The range of relative frequency among last digits given by $R/N=(njmax\u2212njmin)/N$ shows *R*/*N* ∼ *N*^{β}, where *β* = −0.5832 (the standard error = ± 0.0094) for last digits [Fig. 3(b) shows *R*/*N* = 0.5294*N*^{−0.5832} for the trend line], which is identical to the case of coin tossing. This result supports the validity of prob(*j*) = 25% for one of the four last digits by *R*/*N* → 0 at *N* → ∞, indicating that the last digit of primes would occur with the same frequency for large numbers.

The above two examples of equally likely outcomes lead to the same result: as the size of the sample (*N*) increases, the range of relative frequency (*R*/*N*) decreases, following the power law scaling *R*/*N* ∼ *N*^{β}. Here, the *β* exponents were found to be approximately −0.6 for coin tossing experiments with prob(*i*) = 50% for two equal outcomes and last digits of primes with prob(*j*) = 25% for four equal outcomes. Interestingly, there is a slight difference in the prefactor of the power-law scaling.^{22} This result *R*/*N* ∼ *N*^{−0.6} indicates *R*/*N* → 0 at *N* → ∞ and confirms that randomness can be valid for large numbers for both cases, supporting that tossing coins and finding last digits of prime numbers are statistically identical with respect to equally likely outcomes.

## IV. CONCLUSION

In conclusion, we introduced a simple expression of randomness for large numbers. From statistical analyses of coin tosses and last digits of primes, we showed that the range of relative frequency between equally likely outcomes (*R*/*N*) decreases as the total repetition number (*N*) increases. A power-law scaling for *R*/*N* vs *N* in both cases was found as *R*/*N* ∼ *N*^{β} (*β* ≈ −0.6), implying that the frequency of each outcome becomes equal (*R*/*N* → 0) as the total number of repetitions increases (*N* → ∞). The condition *R*/*N* → 0 at *N* → ∞ explains why randomness is valid only for large numbers. This result experimentally confirms that finding last digits of primes is intrinsically identical to tossing coins in statistics: the problems of equally likely outcomes are the same in both cases. Finally, our finding of the power-law relation between the range of relative frequency among equally likely outcomes and the total number of repetitions would be significant to understand the validity of randomness for large numbers (known as the law of large numbers), which would be important in statistics, physics, and mathematics.

## SUPPLEMENTARY MATERIAL

See the supplementary material for Tables S1–S6 of coin tossing experiments and last digits of prime numbers.

## ACKNOWLEDGMENTS

This research was supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (Grant Nos. NRF-2016R1D1A1B01007133 and 2019R1A6A1A03033215).