cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A348168 Segment the list of prime numbers into sublists L_1, L_2, ... with L_1 = {2} and L_n = {p_1, p_2, ..., p_a(n)}, where a(n) is the largest m such that for 0 < i < m, p_1 - prevprime(p_1) > p_2 - p_1 >= p_{i+1} - p_i.

This page as a plain text file.
%I A348168 #24 Jul 08 2025 15:46:31
%S A348168 1,1,1,1,2,2,1,2,4,1,2,3,2,1,6,2,2,2,1,2,1,2,2,2,1,4,2,8,1,4,2,2,1,1,
%T A348168 5,2,1,2,2,2,1,4,6,2,2,5,8,7,2,1,1,2,10,2,2,2,2,1,4,4,2,1,5,2,1,1,2,2,
%U A348168 2,2,1,2,2,1,4,1,1,3,2,2,3,1,2,1,2,1,2
%N A348168 Segment the list of prime numbers into sublists L_1, L_2, ... with L_1 = {2} and L_n = {p_1, p_2, ..., p_a(n)}, where a(n) is the largest m such that for 0 < i < m, p_1 - prevprime(p_1) > p_2 - p_1 >= p_{i+1} - p_i.
%C A348168 The gap between two consecutive primes in L_n is smaller than g_{n-1} and g_n, where g_n is the gap between L_n and L_{n+1}. Sublists of length 2 are the most frequent ones and any pair of twin primes >= 11 stay in the same sublist.
%C A348168 Conjecture 1: lim_{n->oo} N_i/n = k_i, where N_i is the number of the first n sublists consisting of i primes and k_i is a constant, with k_2 > k_1 > k_3 > k_4 > ... .
%C A348168 Conjecture 2: lim_{n->oo} (Sum_{i=1..n} a(i))/n = Sum_{i=1..oo} i*k_i = e, meaning that, as n tends to infinity, the average length of sublists approaches 2.71828... (see the partial average - n plot in the links).
%C A348168 From _Ya-Ping Lu_, Apr 15 2024: (Start)
%C A348168 The distribution of sublists with 1, 2, 3, 4 and 5 primes and the number of primes in the first n sublists are given in the table below. k_i's as defined in Conjecture 1 are: k1 = 0.281, k2 = 0.431, k3 = 0.127, k4 = 0.058, and k5 = 0.031, approximately. Sublists with length <= 5 account for about 93% of the terms and 70% of the primes, as n approaches infinity.
%C A348168  n            N_1        N_2        N_3        N_4       N_5       # of primes
%C A348168  ----------   ---------  ---------  ---------  --------  --------  -----------
%C A348168  1            1          0          0          0         0         1
%C A348168  10           6          3          0          1         0         16
%C A348168  100          33         44         5          9         3         232
%C A348168  1000         277        431        120        72        36        2617
%C A348168  10000        2821       4225       1243       642       331       27214
%C A348168  100000       28072      42929      12427      6059      3159      276081
%C A348168  1000000      279751     430299     126008     59729     32043     2747392
%C A348168  10000000     2804959    4303512    1264532    592726    317127    27426366
%C A348168  100000000    28070302   43078975   12686566   5869443   3143266   273972452
%C A348168  1000000000   280903920  431182582  127100032  58293618  31258182  2737643048
%C A348168 (End)
%H A348168 Ya-Ping Lu, <a href="/A348168/a348168.pdf">Partial average of A348168</a>
%H A348168 <a href="/index/Pri#gaps">Index entries for sequences related to gaps between primes</a>
%e A348168 See also the table of the sublists in the examples for A362017.
%e A348168 a(1) = 1 because L_1 = {2} by definition.
%e A348168 In the following examples we use p_0 to denote prevprime(p_1).
%e A348168 a(2) = 1. For the 2nd sublist, p_1 - p_0 = 3 - 2 = 1. If the next prime, 5, is in L_2, then p_2 - p_1 = 2 > p_1 - p_0. Therefore, 5 does not belong to L_2 and L_2 = {3}.
%e A348168 a(5) = 2. For the 5th sublist, p_1 - p_0 = 11 - 7 = 4. p_2 = 13 is in L_5 because p_2 - p_1 = 2 < p_1 - p_0. However, the next prime, 17, is not in L_5 as 17 - 13 > p_2 - p_1. Thus, L_5 = {11, 13}.
%e A348168 a(15) = 6. L_15 = {97, 101, 103, 107, 109, 113}, because p_1 - p_0 = 97-89 > p_2 - p_1 = 101-97 = 4, which is the maximum prime gap in L_15. 127, the prime after 113, is not in L_15 as 127-113 = 14 > p_2 - p_1.
%o A348168 (Python)
%o A348168 from sympy import nextprime
%o A348168 L = [2]
%o A348168 for n in range(1, 100):
%o A348168     print(len(L), end =', ')
%o A348168     p0 = L[-1]; p1 = nextprime(p0); M = [p1]; g0 = p1 - p0; p = nextprime(p1); g1 = p - p1
%o A348168     while g1 < g0 and p - p1 <= g1: M.append(p); p1 = p; p = nextprime(p)
%o A348168     L = M
%Y A348168 Cf. A362017 (first in each sublist), A087641, A226657, A001359, A023200.
%K A348168 nonn,easy
%O A348168 1,5
%A A348168 _Ya-Ping Lu_, Oct 03 2021
%E A348168 Edited by _Peter Munn_, Jul 08 2025