Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #26 Dec 16 2024 14:42:16
%S 2,1,1,2,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,1,2,1,1,1,1,2,1,1,1,
%T 1,1,2,1,1,2,1,1,1,1,4,1,1,1,1,1,1,1,2,3,1,2,1,1,3,1,1,1,1,1,1,1,2,1,
%U 2,1,3,1,2,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,2,2,1,1,1,1
%N a(n) is the number of iterations of the function x --> 2*x - 1 such that x remains prime, starting from A005382(n).
%C Cunningham chain of the second kind of length i is a sequence of prime numbers (p_1, ..., p_i) such that p_(r + 1) = 2*p_r - 1 for all 1 =< r < i. This sequence tells the length of the Cunningham chain of the second kind for primes from A005382.
%F a(A110581(n)) = 1.
%F a(A057326(n)) = 2.
%e n = 1: A005382(1) = 2 --> 3 --> 5 --> 9, 9 is not a prime, thus a(1) = 2.
%e n = 3: A005382(3) = 7 --> 13 --> 25, 25 is not a prime, thus a(3) = 1.
%t s[n_] := -2 + Length[NestWhileList[2*# - 1 &, n, PrimeQ[#] &]]; Select[Array[s, 5000], # > 0 &] (* _Amiram Eldar_, Dec 16 2024 *)
%Y Cf. A000040, A005382, A005383, A057326, A064812, A110581, A307390.
%K nonn
%O 1,1
%A _Ctibor O. Zizka_, Dec 16 2024