cp's OEIS Frontend

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.

A160198 a(n) = min(A122458(n), A159885(n)).

This page as a plain text file.
%I A160198 #13 Apr 16 2020 07:05:44
%S A160198 2,1,2,1,1,1,2,1,2,1,1,1,1,1,2,1,2,1,3,1,1,1,1,1,2,1,1,1,1,1,2,1,2,1,
%T A160198 2,1,3,1,3,1,2,1,1,1,1,1,1,1,2,1,4,1,1,1,1,1,2,1,1,1,1,1,2,1,2,1,4,1,
%U A160198 3,1,2,1,2,1,3,1,3,1,3,1,2,1,13,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,4,1,2
%N A160198 a(n) = min(A122458(n), A159885(n)).
%C A160198 Let f(2n+1) = A000265(3n+2) be defined as in A159885. Then a(n) is the least number k of iterations such that either f^k(2n+1) < 2n+1 or A000120(f^k(2n+1)) < A000120(2n+1).
%C A160198 Using induction, one can prove that the Collatz (3x+1)-conjecture follows from the finiteness of a(n) for every n. - _Vladimir Shevelev_, May 05 2009
%H A160198 Antti Karttunen, <a href="/A160198/b160198.txt">Table of n, a(n) for n = 1..65537</a>
%H A160198 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%p A160198 A000265 := proc(n) option remember ; local a; a := n ; while a mod 2 = 0 do a := a/2 ; end do; a; end proc:
%p A160198 f := proc(n) local m ; m := (n-1)/2 ; A000265(3*m+2) ; end:
%p A160198 A000120 := proc(n) local d; add(d, d=convert(n,base,2)) ; end proc:
%p A160198 A159885 := proc(n) local k, twon1; k := 0 ; twon1 := 2*n+1 ; while ( A000120(twon1) > A000120(n) ) do twon1 := f(twon1) ; k := k+1 ; end do; k ; end proc:
%p A160198 A122458 := proc(n) local tx1,a; a := 0 ; tx1 := 2*n+1 ; while tx1 >= 2*n+1 do if tx1 mod 2 = 0 then tx1 := tx1/2 ; else tx1 := 3*tx1+1 ; a := a+1 ; fi; end do; a ; end proc:
%p A160198 A160198 := proc(n) min(A159885(n),A122458(n)) ; end: seq(A160198(n),n=1..130) ; # _R. J. Mathar_, May 15 2009
%t A160198 a[n_] := Module[{u=2n+1, w, k=0}, w = DigitCount[u, 2, 1]; While[u >= 2n+1 && DigitCount[u, 2, 1] >= w, k++; u = (3(u-1)/2+2)/2^IntegerExponent[ (3(u-1)/2+2), 2]]; k];
%t A160198 Array[a, 105] (* _Jean-François Alcover_, Apr 16 2020, after _Antti Karttunen_ *)
%o A160198 (PARI)
%o A160198 f(n) = ((3*((n-1)/2))+2)/A006519((3*((n-1)/2))+2);  \\ Defined for odd n only. Cf. A075677.
%o A160198 A006519(n) = (1<<valuation(n, 2));
%o A160198 A160198(n) = { my(u = (n+n+1), w = hammingweight(u), k=0); while((u >= (n+n+1))&&(hammingweight(u) >= w), k++; u = f(u)); (k); }; \\ _Antti Karttunen_, Sep 22 2018
%Y A160198 Cf. A000120, A075677, A122458, A159885, A159945, A160267.
%K A160198 nonn,look
%O A160198 1,1
%A A160198 _Vladimir Shevelev_, May 04 2009
%E A160198 a(1) corrected and sequence extended by _R. J. Mathar_, May 15 2009