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 A135287 #16 Mar 02 2023 10:44:13 %S A135287 1,2,1,4,2,1,7,14,7,16,8,4,2,1,15,30,15,32,16,8,4,2,1,24,12,6,3,30,15, %T A135287 44,22,11,43,76,38,19,55,92,46,23,63,104,52,26,13,58,29,76,38,19,69, %U A135287 120,60,30,15,70,35,92,46,23,83 %N A135287 a(0)=1; for n > 0, a(n) = a(n-1)+n if a(n-1) is odd, else a(n) = a(n-1)/2. %C A135287 Let a(0), C1, C2, C be integers. Consider the sequence a(n) = a(n-1) + C1*n + C2 if a(n-1) is not divisible by C or a(n) = a(n-1)/C otherwise. %C A135287 For a fixed C1, C2, C this sequence shows chaotic behavior for some a(0) and a highly regular behavior for other a(0). %C A135287 The parameter C1 tells how many regular subclasses are there. %C A135287 The sequence grows roughly as a(n) ~ n*const. %C A135287 Here C = 2. Other sequences showing very interesting behavior have C = power of 2. %C A135287 Example: C1=3, C2=10, C=3. Thus a(n)= a(n-1)+3*n+10 if a(n-1) is not divisible by 3, or a(n)= a(n-1)/3 otherwise. There are 2 classes: %C A135287 a regular class with 3 subclasses (C1=3) for initial values %C A135287 {a(0)=3,38,79,...} %C A135287 {a(0)=1,8,12,42,47,49,63,77,88,...} %C A135287 {a(0)=2,43,45,...} %C A135287 and a "chaotic" class for other initial values a(0). %H A135287 Reinhard Zumkeller, <a href="/A135287/b135287.txt">Table of n, a(n) for n = 0..10000</a> %p A135287 A135287 := proc(n) option remember ; if n = 0 then 1 ; elif A135287(n-1) mod 2 = 0 then A135287(n-1)/2 ; else n+A135287(n-1) ; fi ; end: seq(A135287(n),n=0..60) ; # _R. J. Mathar_, Dec 12 2007 %t A135287 nxt[{n_,a_}]:={n+1,If[OddQ[a],a+n+1,a/2]}; NestList[nxt,{0,1},60][[;;,2]] (* _Harvey P. Dale_, Mar 02 2023 *) %o A135287 (Haskell) %o A135287 a135287 n = a135287_list !! n %o A135287 a135287_list = 1 : f 1 1 where %o A135287 f x y = z : f (x + 1) z where %o A135287 z = if m == 0 then y' else x + y; (y',m) = divMod y 2 %o A135287 -- _Reinhard Zumkeller_, Mar 02 2012 %Y A135287 Cf. A008336, A005132, A135294. %Y A135287 Cf. A090895. %K A135287 nonn,easy %O A135287 0,2 %A A135287 _Ctibor O. Zizka_, Dec 03 2007, Dec 05 2007 %E A135287 More terms from _R. J. Mathar_, Dec 12 2007 %E A135287 Offset fixed by _Reinhard Zumkeller_, Mar 02 2012