[seqfan] Re: Prime is not random

M. F. Hasler oeis at hasler.fr
Thu May 12 19:30:12 CEST 2016


On Wed, May 11, 2016 at 10:33 PM, <zbi74583.boat at orange.zero.jp> wrote:

>     Hi,Seqfans
>
>     Prime is not random
>     For example see A103271
>

It appears that the bias is there only for "small" primes.
It can be seen from the table on p.14 in arxiv:1603.03720 that for larger
primes (they go only up to 10^12), the differences become smaller, but from
there it is not clear whether it tends to 50:50 or to some distinct limit.
I think the data below hints on a limit of 50:50, i.e., equidistribution of
all "residue sequences" at large x.

The following function counts the number of 2's in A103271 which is the
number of consecutive residues (1,1) or (3,3) mod 4. It considers  n
consecutive primes, starting at  o. Since I use powers of 10 for n, you can
directly read off the percentage of cases { (1,1) or (3,3) } among all 4
possibilities.

cnt(n=10^5,o=2,s=0)=forprime(p=nextprime(1+o),,s+=(o+o=p)%4;n--||break);s\2

cnt(n=10^5,o=10^5) = 42820
cnt(n=10^5,o=10^6) = 43408.
cnt(n=10^5,o=10^7) = 44301.
cnt(n=10^5,o=10^8) = 44633.
cnt(n=10^6,o=10^8) = 445971
cnt(n=10^6,o=10^9)  = 451767
cnt(n=10^6,o=10^10)  = 456030
cnt(n=10^5,o=10^10) = 45560 \\ time = 2,290 ms.

cnt(n=10^5,o=10^11\11) = 45135 \\ time = 2,358 ms.
cnt(n=10^5,o=10^11) = 46069 \\ time = 2,557 ms.
cnt(n=10^5,o=10^11\9) = 45607 \\ time = 2,328 ms.

cnt(n=10^5,o=10^12) = 46251 \\ time = 2,913 ms.
cnt(n=10^5,o=10^13) = 46601 \\ time = 3,274 ms.
cnt(n=10^5,o=10^14) = 46634 \\ time = 3,639 ms.
cnt(n=10^5,o=10^15) = 46696 \\ time  = 4,231 ms.

cnt(n=10^5,o=10^21\11) = 47403 \\ t = 10,070 ms.
cnt(n=10^5,o=10^20) = 47786 \\ tc= 10,166 ms.
cnt(n=10^4,o=10^20) = 4820 \\ t = 1,039 ms.
cnt(n=10^5,o=10^21\9) = 47622 \\ t = 10,208 ms.

cnt(n=10^4,o=10^31\11) = 4792 \\ t = 2,514 ms.
cnt(n=10^4,o=10^30) = 4779 \\ t = 2,491 ms.
cnt(n=10^4,o=10^31\9) = 4845 \\ t = 2,475 ms.

cnt(n=10^4,o=10^41\11) = 4851 \\ t = 5,048 ms.
cnt(n=10^4,o=10^40) = 4866 \\ t = 4,849 ms.
cnt(n=10^4,o=10^41\9) = 4792 \\ t = 5,003 ms.

cnt(n=10^5,o=10^51\11) = 48921 \\ t = 1min, 30,886 ms.
cnt(n=10^4,o=10^50) = 4946 \\ t = 8,791 ms.
cnt(n=10^4,o=10^51\9) = 4802 \\ t = 8,978 ms.

cnt(n=10^4,o=10^61\11) = 4833 \\ t = 14,194 ms.
cnt(n=10^4,o=10^60) = 4933 \\ t = 13,887 ms.
cnt(n=10^4,o=10^61\9) = 4881 \\ t = 13,908 ms.

cnt(n=10^4,o=10^70\9) = 4876 \\ t = 22,029 ms.
cnt(n=10^4,o=10^71\11) = 4957 \\ t = 22,718 ms.
cnt(n=10^4,o=10^70) = 4959 \\ t = 22,064 ms.
cnt(n=10^4,o=10^71\9) = 4850 \\ t = 22,696 ms.

cnt(n=10^4,o=10^81\11) = 4889 \\ t = 43,562 ms.
cnt(n=10^4,o=10^80) = 4923 \\ t = 43,312 ms
cnt(n=10^4,o=10^81\9) = 4950 \\ t = 43,415 ms.



>     The randomness of A103270  is much smaller than A103271
>

I don't agree, the run lengths of 0's look more random to me, I can't see a
pattern.
Maybe you mean "balanced" (frequence of 0's vs 2's) instead of "random",
yes it looks as if 0's are much more frequent, but this seems

    Could anyone compute more terms?
>

I added a simple PARI function there. It yields:
sum(n=2,1000,a(n)) = 670 \\ i.e. 33.5% of 2's
sum(n=2,10^4,a(n)) = 8270 \\ i.e., 41.3% of 2's

To go further one should write a more optimized function using forprime()
to avoid calls to prime(n) and prime(n+1).
But I don't know whether this is a promising direction to find out more
about the distribution of primes.
(If I had to make a wild guess, I'd "conjecture" that this (as well the
"n-k" variant suggested in the previous mail) tends quite early (much
faster than A103271) to a "random" sequence with as many 0's as 2's.)

Maximilian



More information about the SeqFan mailing list