Randomness at large numbers: Experimental proof in coin toss and prime number

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][2][3][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][2][3][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][9][10][11][12][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][16][17][18][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][17][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 (ni) can vary complicatedly according to experiments and conditions. The relative frequency of an outcome (f i) is calculated by dividing ni 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 (n max i ) and the minimum frequency (n min i ), consequently described as R = (n max i −n min i ). 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 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. 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   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 ARTICLE scitation.org/journal/adv

FIG. 2.
Last digits of prime numbers: (a) schematic illustration of last digits (1, 3, 7, and 9) of prime numbers up to 10 7 ; the probability of each last digit is expected to be equal to 25% for large numbers and (b) the relative frequency of last digits gradually approaches to 25% (toward the dashed lines); the raw data are summarized in Table S6 of the supplementary material.
heads and tails given by R/N = (n max i −n min i )/N as R/N ∼ N β , where β = α − 1 < 0. As illustrated in Fig. 3(a), R/N = 3.1461N −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 = (n max j −n min j )/N shows R/N ∼ N β , where β = −0.5832 (the standard error = ± 0.0094) for last digits [ Fig. 3(b) shows R/N = 0.5294N −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.

FIG. 3.
Analogy between coin tosses and last digits of primes: the range of relative frequency (R/N) (a) for coin tosses between heads (with error bars resulting from one standard deviation from five experiments) and tails and (b) for last digits among four last digits (with no error bars because the prime numbers are deterministic); in both cases, a power-law scaling of R/N ∼ N β is found with β = −0.6237 (the standard error = ± 0.0272) for coin tosses and β = −0.5832 (the standard error = ± 0.0094) for last digits. The trend line is taken as R/N = 3.1461N −0.6237 (the adjusted R 2 = 0.94085) in (a) and R/N = 0.5294N −0.5832 (the adjusted R 2 = 0.98607) in (b); this result shows that randomness can be valid for large numbers for both cases.
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.