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.

A385871 a(n) is the number of primes in the prime chain to which prime(n) belongs. Details are in the Comments.

This page as a plain text file.
%I A385871 #25 Jul 18 2025 16:45:34
%S A385871 3,3,3,3,3,1,1,2,3,2,1,2,2,1,3,2,1,1,1,1,2,2,3,1,2,2,2,2,1,1,1,2,3,1,
%T A385871 3,1,2,2,2,2,2,4,1,1,1,1,1,2,1,1,3,1,1,1,1,1,1,1,2,4,1,1,1,3,2,1,1,2,
%U A385871 1,1,3,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,2,1,1,3,2
%N A385871 a(n) is the number of primes in the prime chain to which prime(n) belongs. Details are in the Comments.
%C A385871 This sequence originates from a counting game, or process, along the sequence of prime numbers.
%C A385871 At a given prime, the next prime in its chain is determined as follows:
%C A385871 The primes are lined up, and we start counting incrementally at the prime with the value of that prime itself, walking step by step, back towards to the prime 2. At 2 we turn to forward direction without counting twice at 2, and carry on counting further. We pass our starting prime and from there on, we observe whether at some point the count will equal the prime at that count, or not.
%C A385871 If the count and its prime are equal, then that prime is the next in the chain; otherwise the starting prime has no next prime and its chain ends.
%C A385871 To put it more formally:
%C A385871 For prime(k), to find out whether a greater prime(k + m) is directly linked next to prime(k) in a chain, we test if the equation prime(k) + 2*(k - 1) + m = prime(k + m) is satisfied for some m integer > 0.
%C A385871 Each prime has at most 1 predecessor in this rule so that the steps make a chain.
%C A385871 If prime(n) does not chain to a next prime, and no preceding prime chains to it, then its chain consists of itself only and has length a(n) = 1.
%H A385871 Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a385/A385871.java">Java program</a> (github)
%e A385871 The counting walk from 5:
%e A385871  2        3        5        7       11       13       17       19       23
%e A385871  7   <-   6   <-   5
%e A385871      ->   8   ->   9   ->  10   ->  11
%e A385871                                      ^
%e A385871                                      |
%e A385871                                    Match
%e A385871 The counting walk from 11:
%e A385871  2        3        5        7       11       13       17       19       23
%e A385871 15  <-   14   <-  13   <-  12  <-   11
%e A385871     ->   16   ->  17   ->  18  ->   19   ->  20   ->  21   ->  22  ->   23
%e A385871                                                                          ^
%e A385871                                                                          |
%e A385871                                                                        Match
%e A385871 Since 5 cannot be reached from any lesser prime, and no greater prime can be reached either from 23 by this method, 5, 11, and 23 belong to a common prime chain of length 3, allowing a(3), a(5), and a(9) terms the value of 3 each.
%e A385871 The counting walk from 13:
%e A385871  2     3     5     7    11    13    17    19    23    29    31    37
%e A385871 18 <- 17 <- 16 <- 15 <- 14 <- 13
%e A385871    -> 19 -> 20 -> 21 -> 22 -> 23 -> 24 -> 25 -> 26 -> 27 -> 28 -> 29
%e A385871                                                       ^
%e A385871                                                       |
%e A385871                                                   No match
%e A385871                                             as the faster growing
%e A385871                                             prime sequence here already
%e A385871                                             overtook the counting sequence
%e A385871                                             without reaching equal values
%e A385871                                             at any second point.
%e A385871 .
%e A385871 Therefore 13 forms a chain with one solitary link only, and so a(6) = 1.
%e A385871 .
%e A385871 In another example, the primes 2, 3, and 7 are in a prime chain of length 3 because
%e A385871   2 = prime(1), so k = 1
%e A385871 and
%e A385871   prime(1) + 2*(1 - 1) + m = prime(1 + m)
%e A385871   2 + 2*0 + m = prime(1 + m)
%e A385871   2 + m = prime(1 + m)
%e A385871 Solved for m by search: m = 1
%e A385871 and since
%e A385871   2 + 1 = prime(1 + 1)
%e A385871   3 = prime(2) -> so far, 3 is linked to 2 in a prime chain.
%e A385871 Furthermore:
%e A385871   3 = prime(2), so let now k = 2
%e A385871 and
%e A385871   prime(2) + 2*(2 - 1) + m = prime(2 + m)
%e A385871   3 + 2*1 + m = prime(2 + m)
%e A385871   5 + m = prime(2 + m)
%e A385871 Solved for m by search: m = 2
%e A385871 and since
%e A385871   5 + 2 = prime(2 + 2)
%e A385871   7 = prime(4) -> so far, 7 is linked to 2 and 3 in a prime chain.
%e A385871 Checking for further members to the 2-3-7 prime chain:
%e A385871   prime(4) + 2*(4 - 1) + m = prime(4 + m)
%e A385871   7 + 2*3 + m = prime(4 + m)
%e A385871   7 + 6 + m = prime(4 + m)
%e A385871   13 + m = prime(4 + m)
%e A385871 No such m > 0 is found, so m and prime(4 + m) cannot exist to satisfy the equation.
%e A385871 The 2-3-7 prime chain has no more members, therefore they form a chain of length 3, and so the terms a(1), a(2), and a(4) each equal to 3.
%e A385871 The prime chains to which the first few primes belong:
%e A385871    2     {2, 3, 7},
%e A385871    3     {2, 3, 7},
%e A385871    5     {5, 11, 23},
%e A385871    7     {2, 3, 7},
%e A385871   11     {5, 11, 23},
%e A385871   13     {13},
%e A385871   17     {17},
%e A385871   19     {19, 37},
%e A385871   23     {5, 11, 23},
%e A385871   29     {29, 53},
%e A385871   31     {31},
%e A385871   37     {19, 37},
%e A385871   41     {41, 73},
%e A385871   43     {43},
%e A385871   47     {47, 83, 137},
%e A385871   53     {29, 53},
%e A385871   ...
%Y A385871 Cf. A000040.
%K A385871 nonn
%O A385871 1,1
%A A385871 _Tamas Sandor Nagy_, Jul 11 2025
%E A385871 More terms from _Michel Marcus_, Jul 13 2025