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 A375155 #24 Aug 02 2024 04:38:56 %S A375155 147,295,591,1183,2367,4735,9471,18943,37887,75775,151551,303103, %T A375155 606207,1212415,2424831,4849663,9699327,19398655,38797311,77594623, %U A375155 155189247,310378495,620756991,1241513983,2483027967,4966055935,9932111871,19864223743,39728447487,79456894975 %N A375155 a(n) = 2*a(n-1) + 1 for a(n-1) not prime, otherwise a(n) = prime(n) - 1; with a(1) = 147. %C A375155 Variant of A374965 with initial condition a(1) = 147. If a(1) is prime, the trajectory is: a(1), 2, 4, 9, ... and matches A374965 after the second term. It appears that for most composite a(1), the trajectories also converge towards A374965. This could be due to A050412(n) being small for many composite n. %C A375155 a(1) = 147 is the first composite number where the trajectory appears not to converge towards A374965. %C A375155 Other values of a(1) for which the trajectory converges to this sequence are: 295, 591, 1183, 2278, 2367, 3328, 4557, 4602, 4735, 5950, 6072, 6657, 7227, 9115, 9205, 9471, 9612, 9912, 9955, ... %H A375155 Chai Wah Wu, <a href="/A375155/b375155.txt">Table of n, a(n) for n = 1..7697</a> %t A375155 Module[{n = 1}, NestList[If[n++; PrimeQ[#], Prime[n] - 1, 2*# + 1] &, 147, 50]] (* _Paolo Xausa_, Aug 02 2024 *) %o A375155 (Python) %o A375155 from itertools import islice %o A375155 from sympy import isprime, nextprime %o A375155 def A375155_gen(): # generator of terms %o A375155 a, p = 147, 3 %o A375155 while True: %o A375155 yield a %o A375155 a, p = p-1 if isprime(a) else (a<<1)|1, nextprime(p) %o A375155 A375155_list = list(islice(A375155_gen(),40)) %Y A375155 Cf. A050412, A052333, A373799, A374965. %K A375155 nonn %O A375155 1,1 %A A375155 _Chai Wah Wu_, Aug 01 2024