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.

A350277 Indices of records in A349325.

Original entry on oeis.org

1, 3, 6, 7, 14, 19, 54, 73, 129, 313, 353, 470, 5838, 10855, 14473, 26283, 60220, 60221, 155897, 445089, 1098406, 1168014, 1169865, 4143030, 8546945, 10964814, 11395926, 31273927, 590633697, 1117772702, 1240568869, 1240568870, 2845683047, 2963752572, 2963752573
Offset: 1

Views

Author

Paolo Xausa, Dec 22 2021

Keywords

Crossrefs

Programs

  • Mathematica
    A349325[n_]:=Module[{h=1,c=n,prevc=n},While[c>1,If[OddQ[c],c=(3c+1)/2;If[prevcn,h++],c/=2^IntegerExponent[c,2];If[prevc>n&&cA349325[i])>rec,rec=r;AppendTo[a,i]],{i,upto}];a
  • 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
    rec, rec_idx = -1, []
    for i in range(1, 10000):
        r = A349325(i)
        if r > rec:
            rec = r
            rec_idx.append(i)
    print(rec_idx)

Extensions

a(24)-a(35) from Chai Wah Wu, Jan 04 2022

A350278 Index of first occurrence of n in A349325.

Original entry on oeis.org

1, 3, 6, 7, 14, 19, 54, 109, 110, 73, 146, 145, 328, 129, 342, 345, 398, 337, 462, 313, 3708, 353, 470, 14673, 5838, 10855, 23718, 14473, 60216, 26283, 60220, 60221, 500726, 155897, 1098404, 445089, 1098406, 1316099, 1168014, 1386505, 3932646, 1169865, 4424230
Offset: 1

Views

Author

Paolo Xausa, Dec 22 2021

Keywords

Examples

			a(5) = 14 because 5 occurs for the first time at position 14 in A349325.
		

Crossrefs

Programs

  • Mathematica
    A349325[n_]:=A349325[n]=Module[{h=1,c=n,prevc=n},While[c>1,If[OddQ[c],c=(3c+1)/2;If[prevcn,h++],c/=2^IntegerExponent[c,2];If[prevc>n&&cA349325[++i]!=n];i,{n,nterms}]
  • 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
    def A349325_fo_idx(n):
        i = 1
        while A349325(i) != n:
            i += 1
        return i
    print([A349325_fo_idx(n) for n in range(1, 20)])

Extensions

a(36)-a(43) from Chai Wah Wu, Jan 04 2022

A304030 a(n) is the number of steps at which the Collatz ('3x+1') trajectory of n crosses its initial value, or -1 if the number of crossings is infinite.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 3, 0, 5, 2, 3, 2, 3, 8, 3, 0, 3, 10, 7, 0, 1, 6, 1, 0, 9, 2, 3, 6, 7, 4, 3, 0, 13, 4, 1, 4, 5, 8, 9, 0, 7, 2, 5, 2, 3, 4, 5, 0, 5, 8, 5, 0, 1, 14, 9, 0, 7, 2, 3, 6, 7, 12, 9, 0, 5, 6, 3, 0, 1, 4, 7, 0, 13, 2, 1, 2, 3, 8, 3, 0, 7, 14, 11, 0, 1, 8, 3, 0, 3, 2, 7, 4, 5, 12, 9, 0, 19, 4, 1, 0
Offset: 1

Views

Author

Jon E. Schoenfield, May 04 2018

Keywords

Comments

Some treatments of the Collatz conjecture view trajectories as starting to cycle when they reach 1, continuing with 4, 2, 1, 4, 2, 1, ..., while others view trajectories as terminating as soon as 1 is reached; this sequence treats trajectories as terminating at 1.
If the Collatz conjecture is true, then for n > 1, a(n) == n (mod 2).
If there exists any number n whose Collatz trajectory enters a cycle that includes values above and below n, then the number of crossings would be infinite. If the Collatz conjecture is true, then there exists no such value of n.
If a(k) = 0, then a(2^j * k) = 0, for j>0. Therefore the primitives are 1, 20, 24, 52, 56, 68, 72, 84, 88, 100, 116, ..., . - Robert G. Wilson v, May 19 2018

Examples

			The Collatz trajectory of 6 crosses its initial value (6) a total of 4 times, so a(6) = 4:
.
                           16
                           / \
                          /   \
              10         /     \
              / \       /       \
             /   \     /         8
  6---------*-----*---*-----------*--------
   \       /       \ /             \
    \     /         5               \
     \   /                           \
      \ /                             4
       3                               \
                                        ...
(Each "*" represents a crossing.)
		

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]]; Array[f, 100] (* Robert G. Wilson v, May 05 2018 *)
  • Python
    def A304030(n):
        prevc = c = n
        h = 0
        while c > 1:
            if c % 2:
                c = 3*c+1
                if prevc < n and c > n: h += 1
            else:
                c //= 2
                if prevc > n and c < n: h += 1
            prevc = c
        return h
    print([A304030(n) for n in range(1, 100)]) # Paolo Xausa, Feb 22 2022
Showing 1-3 of 3 results.