A381169 List of twin prime averages (A014574) is partitioned by including as many elements as possible in the n-th partition, L_n, such that any gap in L_n is smaller than the gap between L_n and L_(n-1) but not bigger than the first gap in L_n. a(n) is the number of elements in L_n.
1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 2, 2, 1, 1, 2, 1, 6, 3, 2, 2, 2, 1, 1, 5, 2, 2, 2, 3, 1, 2, 2, 2, 2, 3, 2, 2, 1, 2, 4, 2, 2, 2, 2, 5, 2, 2, 1, 1, 1, 3, 2, 2, 1, 3, 3, 2, 1, 4, 2, 3, 2, 2, 1, 2, 2, 3, 3, 1, 3, 2, 1, 2, 1, 1, 2, 3, 3, 1, 1, 2, 2, 3, 2, 2, 1, 5, 2
Offset: 1
Keywords
Examples
Twin prime pair averages in the first 10 partitions are: [4], [6], [12], [18], [30], [42], [60, 72], [102, 108], [138, 150], and [180, 192, 198]. Thus, a(1) = a(2) = a(3) = a(4) = a(5) = a(6) = 1, a(7) = a(8) = a(9) = 2, and a(10) = 3.
Programs
-
Python
from sympy import isprime, nextprime; L = [4] def nexttwin(x): p1 = nextprime(x); t1 = p1 + 2 while isprime(t1) == 0: p1 = nextprime(t1); t1 = p1 + 2 return p1+1 for _ in range(2, 89): print(len(L), end = ', ') t0 = L[-1]; t1 = nexttwin(t0); g0 = t1 - t0; M = [t1]; t = nexttwin(t1); g1 = t - t1 while g1 < g0 and t - t1 <= g1: M.append(t); t1 = t; t = nexttwin(t) L = M
Comments