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.

A306577 Last odd number reached by n before 1 through Collatz iteration, where a(n) = 1 when no other odd number is reached, or -1 if 1 is never reached.

This page as a plain text file.
%I A306577 #35 Dec 06 2021 03:07:53
%S A306577 1,1,5,1,5,5,5,1,5,5,5,5,5,5,5,1,5,5,5,5,21,5,5,5,5,5,5,5,5,5,5,1,5,5,
%T A306577 5,5,5,5,5,5,5,21,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,
%U A306577 5,5,5,5,5,5,85,5,5,5,5,5,5,5,5,21,85,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
%N A306577 Last odd number reached by n before 1 through Collatz iteration, where a(n) = 1 when no other odd number is reached, or -1 if 1 is never reached.
%C A306577 Assuming the Collatz conjecture is true, every a(n) is defined. Each entry in this sequence will be a member of A002450, as these are the odd numbers that result in powers of 2. Due to the abundance of entries equal to 5, one may wish to study the values not equal to 5.
%C A306577 From _Michael De Vlieger_, Mar 05 2019: (Start)
%C A306577 Indices n of the first appearance of odd k:
%C A306577         k         n
%C A306577         1         1
%C A306577         5         3
%C A306577        21        21
%C A306577        85        75
%C A306577       341       151
%C A306577      1365      1365
%C A306577      5461      5461
%C A306577     21845     14563
%C A306577     87381     87381
%C A306577    349525    184111
%C A306577   1398101    932067
%C A306577   5592405   5592405 (End)
%H A306577 Antti Karttunen, <a href="/A306577/b306577.txt">Table of n, a(n) for n = 1..14563</a>
%H A306577 Antti Karttunen, <a href="/A306577/a306577.txt">Data supplement: n, a(n) computed for n = 1..87381</a>
%e A306577 From _Felix Fröhlich_, Apr 25 2019: (Start)
%e A306577 For n = 16: The Collatz trajectory of 16 up to the first occurrence of 1 is 16, 8, 4, 2, 1. The trajectory does not include any odd number other than 1, so a(16) = 1.
%e A306577 For n = 42: The Collatz trajectory of 42 up to the first occurrence of 1 is 21, 64, 32, 16, 8, 4, 2, 1. The last odd number occurring before 1 is 21, so a(42) = 21. (End)
%t A306577 Array[If[! IntegerQ@ #, 1, #] &@ SelectFirst[Reverse@ Most@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, #, # > 1 &], OddQ] &, 100] (* _Michael De Vlieger_, Mar 05 2019 *)
%o A306577 (PARI) next_iter(n) = if(n%2==0, return(n/2), return(3*n+1))
%o A306577 a(n) = my(x=n, oddnum=1); while(x!=1, if(x%2==1, oddnum=x); x=next_iter(x)); oddnum \\ _Felix Fröhlich_, Apr 25 2019
%Y A306577 Cf. A006370, A002450, A247272, A247346, A247715, A247716.
%K A306577 nonn,easy
%O A306577 1,3
%A A306577 _Aidan Simmons_, Feb 24 2019
%E A306577 Escape clause added to the definition by _Antti Karttunen_, Dec 05 2021