The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.



(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A320393 First members of the Cunningham chains of the first kind whose length is a prime. 0


%S 2,3,11,23,29,41,53,83,113,131,173,179,191,233,239,251,281,293,419,

%T 431,443,491,593,641,653,659,683,719,743,761,809,911,953,1013,1019,

%U 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 First members of the Cunningham chains of the first kind whose length is a prime.

%e 41 is an item as it generates the Cunningham chain (41, 83, 167), of length 3, that is prime.

%t aQ[n_] := PrimeQ[Length[NestWhileList[2#+1&, n, PrimeQ]] - 1]; Select[Range[2200], aQ] (* _Amiram Eldar_, Dec 11 2018 *)

%o (Python)

%o from sympy.ntheory import isprime

%o def cunningham_chain(p,t):

%o #it returns the cunningham chain generated by p of type t (1 or 2)

%o if not(isprime(p)):

%o raise Exception("Invalid starting number! It must be prime")

%o if t!=1 and t!=2:

%o raise Exception("Invalid type! It must be 1 or 2")

%o elif t==1: k=t

%o else: k=-1

%o cunn_ch=[]

%o cunn_ch.append(p)

%o while isprime(2*p+k):

%o p=2*p+k

%o cunn_ch.append(p)

%o return(cunn_ch)

%o from sympy import prime

%o n=350

%o r=""

%o for i in range(1,n):

%o cunn_ch=(cunningham_chain(prime(i),1))

%o lcunn_ch=len(cunn_ch)

%o if isprime(lcunn_ch):

%o r += ","+str(prime(i))

%o print(r[1:])

%Y Cf. A059761, A059762, A059764.

%K nonn

%O 1,1

%A _Pierandrea Formusa_, Dec 10 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 5 16:53 EDT 2020. Contains 333245 sequences. (Running on oeis4.)