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.

A277367 a(n) = gcd(A006666(n), A006667(n)) where A006666 and A006667 are respectively the number of halving and tripling steps in the '3x+1' problem.

This page as a plain text file.
%I A277367 #11 Nov 05 2016 08:06:32
%S A277367 0,1,1,2,1,2,1,3,1,1,2,1,1,1,1,4,3,2,2,1,1,1,1,2,1,2,1,1,1,1,1,5,2,1,
%T A277367 1,3,3,3,1,1,1,1,1,4,4,4,2,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,6,1,1,1,1,
%U A277367 1,1,1,2,1,2,1,2,2,1,1,1,2,10,10,1,1,3,3
%N A277367 a(n) = gcd(A006666(n), A006667(n)) where A006666 and A006667 are respectively the number of halving and tripling steps in the '3x+1' problem.
%H A277367 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F A277367 a(2^m) = m.
%e A277367 a(17) = 3 because gcd(A006666(17), A006667(17)) = gcd(9, 3) = 3.
%p A277367 nn:=100:
%p A277367 for n from 1 to nn do:
%p A277367 m:=n:it0:=0:it1:=0:
%p A277367    for j from 1 to 1000 while(m<>1) do:
%p A277367     if irem(m,2)=0
%p A277367      then
%p A277367      m:=m/2:it0:=it0+1:
%p A277367      else
%p A277367      m:=3*m+1:it1:=it1+1:
%p A277367     fi:
%p A277367    od:
%p A277367    q:=gcd(it0,it1):printf(`%d, `,q):
%p A277367   od:
%t A277367 Table[GCD[Count[NestWhileList[If[OddQ@ #, 3 # + 1, #/2] &, n, # > 1 &], _?EvenQ], Count[Differences[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &]], _?Positive]], {n, 87}] (* _Michael De Vlieger_, Oct 13 2016, after _Harvey P. Dale_ at A006666 and A006667 *)
%o A277367 (PARI) a(n) = {my(se = 0); my(so = 0); while (n!=1, if (n % 2, so++; n = 3*n+1, se++; n = n/2);); gcd(se, so);} \\ _Michel Marcus_, Oct 13 2016
%Y A277367 Cf. A006666, A006667, A277068.
%K A277367 nonn
%O A277367 1,4
%A A277367 _Michel Lagneau_, Oct 11 2016