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.
%I A377618 #8 Nov 21 2024 11:36:29 %S A377618 5,17,3,1,15,1,3,1,1,1,1,1,3,1,1,5,1,1,1,5,1,1,3,1,1,1,1,1,1,1,1,5,5, %T A377618 1,1,1,1,1,1,3,1,1,1,1,3,1,1,1,3,1,1,1,1,1,1,5,1,1,1,3,1,13,1,1,1,1,1, %U A377618 1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,3,1,1 %N A377618 a(n) is the number of iterations of x -> 4*x - 1 until (# composites reached) = (# primes reached), starting with prime(n). %C A377618 For a guide to related sequences, see A377609. %e A377618 Starting with prime(1) = 2, we have 4*2-1 = 7, then 4*7-1 = 27, etc., %e A377618 resulting in a chain 2, 7, 27, 107, 427, 1707 having 3 primes and 3 composites. Since every initial subchain has fewer composites than primes, a(1) = 6-1 = 5. (For more terms from the mapping x -> 4x-1, see A136412.) %t A377618 chain[{start_, u_, v_}] := If[CoprimeQ[u, v] && start*u + v != start, %t A377618 NestWhile[Append[#, u*Last[#] + v] &, {start}, ! %t A377618 Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &], {}]; %t A377618 chain[{Prime[1], 4, -1}] %t A377618 Map[Length[chain[{Prime[#], 4, -1}]] &, Range[1, 100]] - 1 %t A377618 (* _Peter J. C. Moses_, Oct 31 2024 *) %Y A377618 Cf. A377609, A136412. %K A377618 nonn %O A377618 1,1 %A A377618 _Clark Kimberling_, Nov 17 2024