|
|
A338945
|
|
Lengths of Cunningham chains of the first kind that are sorted by first prime in the chain.
|
|
5
|
|
|
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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
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.
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.
Starting from 13, we find 2(13) + 1 = 27, thus we have a singleton chain and have a(3) = 1, etc.
|
|
MATHEMATICA
|
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]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|