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.

A320393 First members of the Cunningham chains of the first kind whose length is a prime.

This page as a plain text file.
%I A320393 #30 Jan 23 2019 10:54:01
%S A320393 2,3,11,23,29,41,53,83,113,131,173,179,191,233,239,251,281,293,419,
%T A320393 431,443,491,593,641,653,659,683,719,743,761,809,911,953,1013,1019,
%U A320393 1031,1049,1103,1223,1289,1439,1451,1481,1499,1511,1559,1583,1601,1733,1811,1889,1901,1931,1973,2003,2039,2063,2069,2129,2141
%N A320393 First members of the Cunningham chains of the first kind whose length is a prime.
%e A320393 41 is an item as it generates the Cunningham chain (41, 83, 167), of length 3, that is prime.
%t A320393 aQ[n_] := PrimeQ[Length[NestWhileList[2#+1&, n, PrimeQ]] - 1]; Select[Range[2200], aQ] (* _Amiram Eldar_, Dec 11 2018 *)
%o A320393 (Python)
%o A320393 from sympy.ntheory import isprime
%o A320393 def cunningham_chain(p,t):
%o A320393     #it returns the cunningham chain generated by p of type t (1 or 2)
%o A320393     if not(isprime(p)):
%o A320393         raise Exception("Invalid starting number! It must be prime")
%o A320393     if t!=1 and t!=2:
%o A320393         raise Exception("Invalid type! It must be 1 or 2")
%o A320393     elif t==1: k=t
%o A320393     else: k=-1
%o A320393     cunn_ch=[]
%o A320393     cunn_ch.append(p)
%o A320393     while isprime(2*p+k):
%o A320393         p=2*p+k
%o A320393         cunn_ch.append(p)
%o A320393     return(cunn_ch)
%o A320393 from sympy import prime
%o A320393 n=350
%o A320393 r=""
%o A320393 for i in range(1,n):
%o A320393     cunn_ch=(cunningham_chain(prime(i),1))
%o A320393     lcunn_ch=len(cunn_ch)
%o A320393     if isprime(lcunn_ch):
%o A320393        r += ","+str(prime(i))
%o A320393 print(r[1:])
%Y A320393 Cf. A059761, A059762, A059764.
%K A320393 nonn
%O A320393 1,1
%A A320393 _Pierandrea Formusa_, Dec 10 2018