%I #7 Mar 23 2026 15:59:03
%S 1,2,2,38,236,850,1000,26840,477368,47036,22339372,73096731,260586441,
%T 1180973647,3853501438,178350939014,1261487067476,3639250753600,
%U 26083459413092,946868742489918,264892551871161,5030764357055773
%N a(n) is the numerator of the expected absolute difference of two primes p1, p2 drawn randomly from the interval 2^n <= p < 2^(n+1) without replacement.
%e 1/1, 2/1, 2/1, 38/5, 236/21, 850/39, 1000/23, 26840/301, 477368/2775, 47036/137, ...
%e a(4)/A394300(4) = 38/5: The 5 primes in the interval [16,31] are 17, 19, 23, 29, 31. Their A036378(4)*(A036378(4)-1)/2 = (5*4)/2 = 10 mutual differences are 2, 6, 12, 14, 4, 10, 12, 6, 8, 2, with sum 76.
%e If all numbers from the interval were in the urn, there would be A006516(4) = 120 pairs, with a mean of A000051(4)/3 = (2^4 + 1)/3 = 17/3. The following table shows that the naive assumption that the expected value of the differences of the drawn prime number pairs is always larger than that obtained when all numbers are in the urn is incorrect.
%e .
%e n A394299(n)/A394300(n) rounded (2^n+1)/3
%e 2 2/1 2.0 1.667
%e 3 2/1 2.0 < 3.0
%e 4 38/5 7.6 5.667
%e 5 236/21 11.238 11.0
%e 6 850/39 21.795 21.667
%e 7 1000/23 43.478 43.0
%e 8 26840/301 89.169 85.667
%e 9 477368/2775 172.025 171.0
%e 10 47036/137 343.328 341.667
%e 11 22339372/32385 689.806 683.0
%e 12 73096731/53708 1361.002 < 1365.667
%e 14 1180973647/216411 5457.087 < 5461.667
%e 15 3853501438/352995 10916.589 < 10923.0
%e 17 1261487067476/28882563 43676.424 < 43691.0
%e 19 26083459413092/149262459 174748.960 < 174763.0
%o (PARI) a394299_300(n) = my(n2=2^n, n22=n2+n2, s=0, k=0); forprime(p1=n2, precprime(precprime(n22)-1), forprime(p2=nextprime(p1+1), n22, s+=(p2-p1); k++)); s/k
%Y A394300 are the corresponding denominators.
%Y Cf. A000051, A006516, A036378.
%K nonn,frac,more
%O 1,2
%A _Hugo Pfoertner_, Mar 23 2026