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 A376801 #16 Nov 16 2024 16:08:57 %S A376801 397,157609,78804,39402,19701,9850,4925,2462,1231,1515361,757680, %T A376801 378840,189420,94710,47355,23677,560600329,280300164,140150082, %U A376801 70075041,35037520,17518760,8759380,4379690,2189845,1094922,547461,273730,136865,68432,34216,17108,8554 %N A376801 a(0) = 397; a(n+1) = a(n)^2 if a(n) is prime, floor(a(n)/2) otherwise. %C A376801 From most starting points, this sequence trivially reaches the cycle (4,2,4,2,...). No other cycles are known to exist. Heuristic results suggest that every starting point almost surely reaches a cycle, despite the colossal size of the intermediate values. a(0) = 397 is the first starting point which is not known to reach the (4,2) cycle: heuristically, the sequence likely runs for 10^12 terms or more before hitting it. %H A376801 Matthew House, <a href="/A376801/b376801.txt">Table of n, a(n) for n = 0..2707</a> %H A376801 Matthew House, <a href="/A376801/a376801.txt">Table of n, a(n) for a(n) prime, n <= 2341068</a> (primes up to 10^10000 proven via ECPP) %H A376801 Joseph O'Rourke et al., <a href="https://mathoverflow.net/q/205911">A Collatz-like function that bifurcates on primes</a>, MathOverflow, 2015-2024. %H A376801 Strashimir G. Popvassilev et al., <a href="https://mathoverflow.net/q/206157">Are there always at least *five* divisions?</a>, MathOverflow, 2015. %F A376801 If a(n) is prime and a(n) >= 13, then a(n+6) = floor(a(n)^2/32). %e A376801 The first few primes in the sequence are 397, 1231, 23677, 1069, 4463, and the value is squared after each of these. Otherwise, the value is halved. %t A376801 NestList[If[PrimeQ[#], #^2, Quotient[#, 2]] &, 397, 50] %o A376801 (Python) %o A376801 from functools import lru_cache %o A376801 from sympy import isprime %o A376801 @lru_cache(maxsize=None) %o A376801 def A376801(n): return (a**2 if isprime(a:=A376801(n-1)) else a>>1) if n else 397 # _Chai Wah Wu_, Oct 25 2024 %K A376801 nonn %O A376801 0,1 %A A376801 _Matthew House_, Oct 04 2024