login
Length of the complete Cunningham chain of the second kind starting with prime(n).
8

%I #43 Nov 24 2021 08:18:22

%S 3,2,1,2,1,1,1,3,1,1,2,2,1,1,1,1,1,1,1,1,1,3,1,1,2,1,1,1,1,1,1,1,1,2,

%T 1,1,2,1,1,1,1,1,1,1,1,2,2,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,3,2,

%U 1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,3,1,1,1

%N Length of the complete Cunningham chain of the second kind starting with prime(n).

%C Number of iterations x -> 2x-1 needed to get a composite number, when starting with prime(n).

%C Dickson's conjecture implies that, for every positive integer r, there exist infinitely many n such that a(n) = r. - _Lorenzo Sauras Altuzarra_, Feb 12 2021

%C a(n) is the least k such that 2^k * (prime(n)-1) + 1 is composite. Note that a(n) is well defined since 2^(p-1) * (p-1) + 1 is divisible by p for odd primes p. - _Jianing Song_, Nov 24 2021

%H T. D. Noe, <a href="/A181715/b181715.txt">Table of n, a(n) for n = 1..10000</a>

%H G. Löh, <a href="http://www.jstor.org/stable/2008735">Long chains of nearly doubled primes</a>, Math. Comp., 53 (1989), 751-759.

%H Michael Penn, <a href="https://www.youtube.com/watch?v=P0G39kdqmbg">Romanian Mathematical Olympiad Problem</a>, Youtube video, 2020.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Cunningham_chain">Cunningham chain</a>

%F a(n) < prime(n) for n > 1; see Löh (1989), p. 751. - _Jonathan Sondow_, Oct 28 2015

%F max(a(n), A181697(n)) = A263879(n) for n > 2. - _Jonathan Sondow_, Oct 30 2015

%F a(n) = A285700(A000040(n)). - _Antti Karttunen_, Apr 26 2017

%e 2 -> 3 -> 5 -> 9 = 3^2, so a(1) = 3 and a(2) = 2. - _Jonathan Sondow_, Oct 30 2015

%p a := proc(n)

%p local c, l:

%p c, l := 0, ithprime(n):

%p while isprime(l) do c, l := c+1, 2*l-1: od:

%p c:

%p end: # _Lorenzo Sauras Altuzarra_, Feb 12 2021

%t Table[p = Prime[n]; cnt = 1; While[p = 2*p - 1; PrimeQ[p], cnt++]; cnt, {n, 100}] (* _T. D. Noe_, Jul 12 2012 *)

%t Table[-1 + Length@ NestWhileList[2 # - 1 &, Prime@ n, PrimeQ@ # &], {n, 98}] (* _Michael De Vlieger_, Apr 26 2017 *)

%o (PARI) a(n)= n=prime(n); for(c=1,1e9, is/*pseudo*/prime(n=2*n-1) || return(c))

%Y Cf. A000040, A005382, A005408, A005602, A005603, A181697, A263879, A285700, A285706, A057326, A057327, A057328, A057329, A057330, A064812.

%Y Cf. A137288 (positions of terms > 1).

%K nonn

%O 1,1

%A _M. F. Hasler_, Nov 17 2010

%E Escape clause added to definition by _N. J. A. Sloane_, Feb 19 2021

%E Escape clause deleted from definition by _Jianing Song_, Nov 24 2021