A166245 Numbers n such that the Collatz trajectory of n (iterate T(k)=k/2 if k is even, (3k+1)/2 if k is odd, A014682, starting at n and stopping if you reach 1) never exceeds n.
1, 2, 4, 8, 10, 12, 16, 20, 24, 26, 28, 32, 34, 36, 40, 42, 44, 48, 50, 52, 56, 58, 64, 66, 68, 72, 74, 76, 80, 84, 88, 90, 92, 96, 98, 100, 104, 106, 112, 114, 116, 120, 122, 128, 130, 132, 136, 138, 140, 144, 148, 152, 154, 156, 160, 162, 168, 170, 172, 176, 178, 180
Offset: 1
Keywords
Examples
1 is a term, because the trajectory stops right there at 1. 2 is a term because the trajectory is 2->1. 3 is not a term because the trajectory is 3 -> 5 -> 8 -> 4 -> 2 -> 1, and 5>3.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
- Douglas J. Shaw, The Pure Numbers Generated by the Collatz Sequence, The Fibonacci Quarterly, Vol. 44, Number 3, August 2006, pp. 194-201.
- Eric Weisstein's World of Mathematics, Collatz Problem
- Wikipedia, Collatz conjecture
- Index entries for sequences related to 3x+1 (or Collatz) problem
Programs
-
Mathematica
L1 = {}; For[i = 1, i < 4096, i++, max = i; n = i; While[n != 1 || Element[n, L1] == False, If[Mod[n, 2] == 1, n = (3 n + 1)/2; If[max <= n, max = n], n = n/2; If[max <= n, max = n]]]; Sort[DeleteDuplicates[L1]]]; ctenQ[n_]:=Max[NestWhileList[If[EvenQ[#],#/2,(3#+1)/2]&,n,#>1&]]<=n; Select[Range[200],ctenQ] (* Harvey P. Dale, Mar 17 2017 *)
-
PARI
is(x)=my(X);X=x;while(x!=1,x=if(x%2,(3*x+1)/2,x/2);if(x>X,return(0)));1
Extensions
Edited by Ralf Stephan, Nov 26 2013
Definition clarified by N. J. A. Sloane, Mar 17 2017
Comments