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.

A338945 Lengths of Cunningham chains of the first kind that are sorted by first prime in the chain.

This page as a plain text file.
%I A338945 #11 Jun 30 2025 04:22:43
%S A338945 5,2,1,1,1,2,1,1,3,1,2,1,1,1,1,1,6,1,1,1,1,2,1,2,1,1,1,1,1,1,2,1,2,1,
%T A338945 1,1,1,1,1,2,2,1,2,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,
%U A338945 1,1,2,1,1,1,1,1,2,1,4,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,2,1
%N A338945 Lengths of Cunningham chains of the first kind that are sorted by first prime in the chain.
%C A338945 Row lengths of A075712.
%H A338945 Michael De Vlieger, <a href="/A338945/b338945.txt">Table of n, a(n) for n = 1..10000</a>
%H A338945 Chris K. Caldwell, <a href="https://primes.utm.edu/glossary/page.php?sort=CunninghamChain">Cunningham Chain</a> (PrimePages, Prime Glossary).
%H A338945 Wikipedia, <a href="https://en.wikipedia.org/wiki/Cunningham_chain">Cunningham chain</a>.
%e A338945 We begin with the smallest prime 2. Since 2(5) + 1 = 11 is prime, further, 2(11) + 1 = 23, 2(23) + 1 = 47 are prime but 2(47) + 1 = 95 is not, we have the complete chain {2, 5, 11, 23, 47} of length 5, thus a(1) = 5.
%e A338945 We resume with 3, since 3 has not appeared in any chain generated thus far. Since 2(3) + 1 = 7, but 2(7) + 1 = 15, we have the complete chain {3, 7}, therefore a(2) = 2.
%e A338945 Starting from 13, we find 2(13) + 1 = 27, thus we have a singleton chain and have a(3) = 1, etc.
%t A338945 Block[{a = {2}, b = {}, j = 0, k, p}, Do[k = Length@ b + 1; If[PrimeQ@ a[[-1]], AppendTo[a, 2 a[[-1]] + 1]; j++, While[! FreeQ[a, Set[p, Prime[k]]], k++]; AppendTo[b, j]; Set[j, 0]; Set[a, Append[a[[1 ;; -2]], p]]], {10^3}]; b]
%Y A338945 Cf. A075712, A338944, A338946.
%K A338945 nonn
%O A338945 1,1
%A A338945 _Michael De Vlieger_, Nov 17 2020