%I #8 Nov 21 2024 11:37:25
%S 1,3,1,5,1,7,1,11,1,1,7,1,1,1,1,1,1,9,3,1,5,5,1,1,9,1,1,1,17,1,1,1,1,
%T 1,1,3,5,1,1,1,1,3,1,3,1,9,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,7,
%U 1,1,9,1,1,1,9,1,1,1,3,1,1,1,1,1,1,1,1
%N a(n) is the number of iterations of x -> 5*x + 2 until (# composites reached) = (# primes reached), starting with prime(n).
%C For a guide to related sequences, see A377609.
%e Starting with prime(1) = 2, we have 5*2+2 = 12; the chain (2,12) has 1 prime and 1 composite. So a(1) = 2-1 = 1.
%t chain[{start_, u_, v_}] := If[CoprimeQ[u, v] && start*u + v != start,
%t NestWhile[Append[#, u*Last[#] + v] &, {start}, !
%t Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &], {}];
%t chain[{Prime[1], 5, 2}]
%t Map[Length[chain[{Prime[#], 5, 2}]] &, Range[1, 100]] - 1
%t (* _Peter J. C. Moses_, Oct 31 2024 *)
%Y Cf. A377609.
%K nonn
%O 1,2
%A _Clark Kimberling_, Nov 17 2024