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.

User: Aidan Simmons

Aidan Simmons's wiki page.

Aidan Simmons has authored 2 sequences.

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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Author

Aidan Simmons, Feb 24 2019

Keywords

Comments

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.
From Michael De Vlieger, Mar 05 2019: (Start)
Indices n of the first appearance of odd k:
k n
1 1
5 3
21 21
85 75
341 151
1365 1365
5461 5461
21845 14563
87381 87381
349525 184111
1398101 932067
5592405 5592405 (End)

Examples

			From _Felix Fröhlich_, Apr 25 2019: (Start)
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.
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)
		

Programs

  • Mathematica
    Array[If[! IntegerQ@ #, 1, #] &@ SelectFirst[Reverse@ Most@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, #, # > 1 &], OddQ] &, 100] (* Michael De Vlieger, Mar 05 2019 *)
  • PARI
    next_iter(n) = if(n%2==0, return(n/2), return(3*n+1))
    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

Extensions

Escape clause added to the definition by Antti Karttunen, Dec 05 2021

A306546 Modified Collatz Map such that odd numbers are treated the same, but even numbers have all factors of 2 removed.

Original entry on oeis.org

4, 1, 10, 1, 16, 3, 22, 1, 28, 5, 34, 3, 40, 7, 46, 1, 52, 9, 58, 5, 64, 11, 70, 3, 76, 13, 82, 7, 88, 15, 94, 1, 100, 17, 106, 9, 112, 19, 118, 5, 124, 21, 130, 11, 136, 23, 142, 3, 148, 25, 154, 13, 160, 27, 166, 7, 172, 29, 178, 15, 184, 31, 190, 1, 196, 33, 202, 17, 208, 35, 214, 9, 220, 37, 226, 19, 232
Offset: 1

Author

Aidan Simmons, Feb 22 2019

Keywords

Comments

All numbers that reach 1 under normal Collatz iteration will reach 1 through this mapping. This sequence combines all consecutive even number halvings into one step. This will decrease steps to completion compared to normal Collatz iteration for all starting points other than 1 and 2, drastically in most cases. If this mapping is applied upon A000265, the sequence generated when the even operation is applied initially, then further iteration through this modified mapping will have all entries synchronize to all either be odd or all be even for any given step.

Crossrefs

Programs

  • PARI
    a(n) = if (n%2, 3*n+1, n >> valuation(n, 2)); \\ Michel Marcus, Mar 05 2019

Formula

For any even n, a(n) = A000265(n). For any odd n, a(n) = 3n+1.