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.

Showing 1-3 of 3 results.

A349325 Number of times the Collatz plot started at n crosses the y = n line, or -1 if the number of crossings is infinite.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 4, 1, 4, 1, 2, 1, 2, 5, 2, 1, 4, 5, 6, 1, 2, 3, 2, 1, 6, 1, 4, 1, 2, 3, 4, 1, 6, 1, 2, 1, 2, 3, 4, 1, 6, 1, 4, 1, 2, 3, 4, 1, 4, 1, 2, 1, 2, 7, 6, 1, 6, 1, 2, 3, 4, 7, 6, 1, 4, 1, 2, 1, 2, 3, 6, 1, 10, 1, 2, 1, 2, 5, 2, 1, 4, 5, 6, 1, 2, 3, 2
Offset: 1

Views

Author

Paolo Xausa, Nov 15 2021

Keywords

Comments

The plots considered are the trajectories from n to 1 of the 3x+1 function, denoted by T(x) in the literature, defined as T(x) = (3x+1)/2 if x is odd, T(x) = x/2 if x is even (A014682).
The starting value of the trajectory is considered a crossing.
A similar sequence for the "standard" Collatz function (A006370) is A304030.
Conjecture: every positive integer appears in the sequence infinitely many times.

Examples

			The trajectory starting at 7 is 7 -> 11 -> 17 -> 26 -> 13 -> 20 -> 10 -> 5 -> 8 -> 4 -> 2 -> 1, so the Collatz plot crosses the y = 7 line at the beginning, from 10 to 5, from 5 to 8 and from 8 to 4, for a total of 4 times. a(7) is therefore 4.
		

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, American Mathematical Society, 2010.

Crossrefs

Programs

  • Mathematica
    nterms=100;Table[h=1;prevc=c=n;While[c>1,If[OddQ[c],c=(3c+1)/2;If[prevcn,h++],c/=2^IntegerExponent[c,2];If[prevc>n&&c
    				
  • PARI
    f(n) = if (n%2, (3*n+1)/2, n/2); \\ A014682
    a(n) = {my(nb=1, prec=n, next); while (prec != 1, next = f(prec); if ((next-n)*(prec-n) <0, nb++); prec = next;); nb;} \\ Michel Marcus, Nov 16 2021
  • Python
    def A349325(n):
        prevc = c = n
        h = 1
        while c > 1:
            if c % 2:
                c = (3*c+1) // 2
                if prevc < n and c > n: h += 1
            else:
                c //= 2
                if prevc > n and c < n: h += 1
            prevc = c
        return h
    print([A349325(n) for n in range(1, 100)])
    

Formula

a(2^k) = 1, for integers k >= 0.
a(A166245(m)) = 1 for m>=1. - Michel Marcus, Nov 16 2021

A301937 a(n) is the smallest number whose Collatz ('3x+1') trajectory crosses its initial value exactly n times.

Original entry on oeis.org

1, 3, 10, 7, 6, 9, 22, 19, 14, 25, 18, 83, 62, 33, 54, 559, 108, 109, 110, 97, 188, 147, 166, 221, 146, 171, 292, 129, 194, 257, 294, 313, 342, 399, 506, 609, 462, 353, 398, 531, 834, 471, 530, 1153, 9854, 417, 470, 627, 8758, 9853, 626, 9225, 18450, 20609, 23718
Offset: 0

Views

Author

Jon E. Schoenfield, May 05 2018

Keywords

Comments

Records: 1, 3, 10, 22, 25, 83, 559, 609, 834, 1153, 9854, 18450, 20609, 23718, 31142, 35090, 41586, 80294, 283262, 377681, 427762, 789305, 887954, 887964, 1403202, 1752022, ..., . - Robert G. Wilson v, May 06 2018

Examples

			The Collatz trajectory for k=3 is 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 crosses the threshold value of 3 on exactly one iteration: the iteration on which it moves from 4 to 2. No smaller value of k shares this property, so a(1) = 3.
The Collatz trajectory for k=6 (see A304030) is nearly identical, containing, in order of appearance, the values 6, 3, 10, 5, 16, 8, 4, 2, 1; it crosses the threshold value of 6 on exactly 4 iterations (3 -> 10, 10 -> 5, 5 -> 16, and 8 -> 4). No smaller value of k shares this property, so a(4) = 6.
		

Crossrefs

Programs

  • Magma
    nMax:=54; a:=[0: n in [1..nMax]]; for k in [2..24000] do n:=0; t:=k; while t gt 1 do tPrev:=t; if IsEven(t) then t:=t div 2; else t:=3*t+1; end if; if (t-k)*(tPrev-k) lt 0 then n+:=1; end if; end while; if (n gt 0) and (n le nMax) then if a[n] eq 0 then a[n]:=k; end if; end if; end for; a;
  • Mathematica
    Collatz[n_] := NestWhileList[ If[ OddQ@#, 3# +1, #/2] &, n, # > 1 &]; f[n_] := Block[{x = Length[ SplitBy[ Collatz@ n, # < n +1 &]] - 1}, If[ OddQ@ n && n > 1, x - 1, x]]; t[] := 0; k = 1; While[k < 24000, If[ t[f[k]] == 0, t[f[k]] = k]; k++]; t@# & /@ Range@54 (* _Robert G. Wilson v, May 05 2018 *)

Formula

a(n) = min{k : A304030(k) = n}.
If the Collatz conjecture is true, then a(n) == n (mod 2) for all terms.

A319738 Numbers whose Collatz trajectories cross their initial values a record number of times.

Original entry on oeis.org

1, 3, 6, 9, 14, 18, 33, 54, 97, 129, 194, 257, 294, 313, 342, 353, 398, 417, 470, 626, 9225, 13739, 14473, 19297, 27681, 38881, 112782, 283261, 427762, 506977, 831527, 876011, 1108702, 1168014, 1848673, 2191019, 5524041, 8546945, 10817230, 10964814, 11395926, 13506283, 15194569, 41698569, 46910891, 52774753
Offset: 1

Views

Author

Robert G. Wilson v, Sep 26 2018

Keywords

Comments

Indices at which records occur in A304030.
Number of crossings of a(n): 0, 1, 4, 5, 8, 10, 13, 14, 19, 27, 28, 29, 30, 31, 32, 37, 38, 45, 46, 50, 51, 55, 57, 59, 61, 69, 70, 71, 72, 77, 79, 81, 82, 88, 93, 97, 99, 113, 116, 120, 128, 129, 131, 139, 141, 143, ..., .
Also a(n) is a term of A301937.

Examples

			9 is a term since A304030(9) = 5 and 5 is greater than any previous term in A304030.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[ If[ OddQ@#, 3# +1, #/2] &, n, # > 1 &]; f[n_] := Block[{x = Length[ SplitBy[ Collatz@n, # < n + 1 &]] - 1}, If[ OddQ@ n && n > 1, x - 1, x]]; mx = -1; k = 1; lst = {}; While[k < 5000001, If[ f@ k > mx, mx = f@ k; AppendTo[lst, k]]; k++]; lst
Showing 1-3 of 3 results.