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 A309786 #23 Feb 16 2025 08:33:56 %S A309786 1,1,1,1,2,1,3,1,3,2,5,1,6,3,4,1,4,3,9,2,6,5,11,1,10,6,9,3,14,4,5,1,5, %T A309786 4,12,3,18,9,12,2,10,6,7,5,12,11,23,1,21,10,8,6,26,9,20,3,9,14,29,4, %U A309786 30,5,6,1,6,5,33,4,22,12,35,3,9,18,20,9,30,12 %N A309786 a(n) is the length of the cycle of the trajectory of 1/n under the map f(x) = min(2*x, 2-2*x). %C A309786 For any rational number q in the interval [0, 1]: %C A309786 - f(q) is rational and lies in the interval [0, 1], %C A309786 - denominator(f(q)) <= denominator(q), %C A309786 - as there are only finitely many rational numbers whose denominator is less than or equal to that of q in the interval [0, 1], %C A309786 - iteratively applying f to q eventually leads to a cycle, %C A309786 - and the sequence is well defined. %C A309786 For any irrational number x in the interval [0, 1]: %C A309786 - f(x) is irrational and lies in the interval [0, 1], %C A309786 - for any k > 0, as fixed points of the k-th iterate of f are rational, %C A309786 - iteratively applying f to x never leads to a cycle. %C A309786 As f is continuous on the interval [0, 1] and 1/7 has least period 3, according to the period three theorem, f has points of any period length, as well as chaotic points. %H A309786 Roman Khrabrov, <a href="/A309786/b309786.txt">Table of n, a(n) for n = 1..10000</a> %H A309786 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PeriodThreeTheorem.html">Period Three Theorem</a> %F A309786 a(2*n-1) = A003558(n-1). %F A309786 a(2*n) = a(n). %F A309786 a(n) = 1 iff n belongs to A029744. %F A309786 a(n) = 2 iff n belongs to A020714. %e A309786 For n = 5: %e A309786 - f(1/5) = 2/5, %e A309786 - f(2/5) = 4/5, %e A309786 - f(4/5) = 2/5, %e A309786 - hence a(5) = 2. %o A309786 (PARI) a(n, f=x -> min(2*x, 2-2*x)) = my (x=f(1/n), y=f(x)); while (x!=y, x=f(x); y=f(f(y))); for (k=1, oo, if (x==y=f(y), return (k))) %Y A309786 Cf. A003558, A020714, A029744. %K A309786 nonn %O A309786 1,5 %A A309786 _Rémy Sigrist_, Aug 17 2019