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.

A095381 Initial values for 3x+1 trajectories in which the largest term arising in the iteration is a power of 2.

This page as a plain text file.
%I A095381 #16 May 25 2016 01:57:29
%S A095381 1,2,3,4,5,6,8,10,12,16,21,32,42,64,85,128,151,170,201,227,256,302,
%T A095381 341,402,454,512,604,682,804,908,1024,1365,2048,2730,4096,5461,8192,
%U A095381 10922,14563,16384,19417,21845,29126,32768,38834,43690,58252,65536,87381
%N A095381 Initial values for 3x+1 trajectories in which the largest term arising in the iteration is a power of 2.
%C A095381 Clearly the sequence is infinite and a(n) < 2^n. - _Charles R Greathouse IV_, May 25 2016
%H A095381 Charles R Greathouse IV, <a href="/A095381/b095381.txt">Table of n, a(n) for n = 1..10000</a>
%F A095381 A025586(a(n)) = 2^j for some j.
%t A095381 Coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3*#+1] &,n,#>1&];t={};Do[x = Max[Coll[n]];If[IntegerQ[Log[2,x]],AppendTo[t,n]],{n,90000}];t (* _Jayanta Basu_, Apr 28 2013 *)
%o A095381 (Haskell)
%o A095381 a095381 n = a095381_list !! (n-1)
%o A095381 a095381_list = map (+ 1) $ elemIndices 1 $ map a209229 a025586_list
%o A095381 -- _Reinhard Zumkeller_, Apr 30 2013
%o A095381 (PARI) is(n)=my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n)); n>>=1); r>>valuation(r,2)==1 \\ _Charles R Greathouse IV_, May 25 2016
%o A095381 (C) // Valid below A006884(47) = 12327829503 on 64-bit machines.
%o A095381 static long is (unsigned long n) {
%o A095381   unsigned long r = n;
%o A095381   n >>= __builtin_ctzl(n); // gcc builtin for A007814
%o A095381   while (n > 1) {
%o A095381     n = 3*n + 1;
%o A095381     if (n > r) r = n;
%o A095381     n >>= __builtin_ctzl(n);
%o A095381   }
%o A095381   return !(r & (r-1));
%o A095381 } // _Charles R Greathouse IV_, May 25 2016
%Y A095381 Cf. A025586, A087256, A209229, A225124.
%K A095381 nonn
%O A095381 1,2
%A A095381 _Labos Elemer_, Jun 14 2004