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-10 of 16 results. Next

A359207 Number of steps to reach 0 starting with n in the map x->A359194(x) (binary complement of 3n), or -1 if 0 is never reached.

Original entry on oeis.org

0, 1, 2, 11, 12, 1, 10, 3, 4, 13, 2, 19, 80, 9, 2, 15, 16, 81, 14, 11, 12, 1, 6, 83, 8, 73, 22, 79, 7572, 5, 18, 75, 76, 7573, 74, 7, 12, 17, 10, 3, 4, 13, 2, 7571, 4, 85, 78, 15, 96, 21, 5498, 91, 72, 13, 6, 7, 56, 13, 82, 3, 20, 5, 98, 15, 16, 21, 14, 7
Offset: 0

Views

Author

Joshua Searle, Dec 20 2022

Keywords

Comments

It is unknown whether each positive starting integer eventually reaches 0.
From Jon E. Schoenfield, Dec 21 2022: (Start)
a(n) == n (mod 4).
a(n) = 1 iff 3*n + 1 = 4^k for some integer k. (End)
All but 10 values under 10^7 have been run to 0. Each of the remaining 10 requires over 2*10^12 steps. They're all in one group that reaches the same high value (nearly 8 million bits wide) after about 2*10^12 steps. The smallest value in this group is 3417582. - Tim Peters, Jun 14 2023

Examples

			a(7) = 3 because it takes 3 steps to reach 0: (7, 10, 1, 0).
		

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Array[-1 + Length@ NestWhileList[f, #, # != 0 &] &, 68, 0] (* Michael De Vlieger, Dec 21 2022, faster function by Hans Havermann *)
  • PARI
    f(n) = if(n, bitneg(n, exponent(n)+1), 1); \\ A035327
    a(n) = my(nb=0, m=n); while (m, m=f(3*m); nb++); nb; \\ Michel Marcus, Dec 21 2022
  • Python
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def a(n):
        i, fi = 0, n
        while fi != 0: i, fi = i+1, f(fi)
        return i
    print([a(n) for n in range(68)]) # Michael S. Branicky, Dec 20 2022
    

A359208 Maximum value reached when starting from n during iteration of the map x->A359194(x) (binary complement of 3n), or -1 if infinite.

Original entry on oeis.org

0, 1, 2, 300, 300, 5, 300, 10, 10, 300, 10, 300, 328536, 300, 21, 300, 300, 328536, 300, 300, 300, 21, 72, 328536, 300, 328536, 661, 328536, 123130640068522377168864228132316865867184046004226894, 40, 300, 328536, 328536
Offset: 0

Views

Author

Joshua Searle, Dec 20 2022

Keywords

Comments

It is unknown whether any terms are -1. The next term a(33) is equal to a(28), a 54-digit number. a(425720) is >= 2.09 * 10^114778, unresolved after 10^10 iterations.
a(425720) = 7.14... * 10^179246. - Joshua Searle, Jan 10 2023

Examples

			a(3) = 300 because the largest term in the iterated sequence: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) is 300.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor[3 n, 2^IntegerPart[Log2[3 n] + 1] - 1]; Table[Max@ NestWhileList[f, n, # != 0 &], {n, 0, 32}] (* Michael De Vlieger, Dec 21 2022 *)
  • PARI
    f(n) = if(n, bitneg(n, exponent(n)+1), 1); \\ A035327
    a(n) = my(x=n, m=n); while (m, m=f(3*m); if (m>x, x=m)); x; \\ Michel Marcus, Dec 21 2022
  • Python
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def a(n):
        i, fi, m = 0, n, n
        while fi != 0: i, fi, m = i+1, f(fi), max(m, fi)
        return m
    print([a(n) for n in range(33)]) # Michael S. Branicky, Dec 20 2022
    

A359209 Numbers that under iteration of the map x->A359194(x) (binary complement of 3n) until 0 is reached never exceed the initial term.

Original entry on oeis.org

0, 1, 2, 5, 10, 21, 39, 40, 42, 71, 72, 78, 85, 142, 150, 157, 163, 167, 168, 170, 285, 291, 300, 303, 311, 313, 315, 316, 317, 319, 320, 321, 322, 327, 328, 329, 331, 333, 334, 335, 336, 338, 339, 340, 341, 569, 571, 572, 573, 575, 576, 577, 578, 579
Offset: 1

Views

Author

Joshua Searle, Dec 20 2022

Keywords

Comments

If it can be shown that all iterations of A359194 eventually reach one of the terms of this sequence, it would prove that all such trajectories are finite.
From M. F. Hasler, Dec 26 2022: (Start)
(1) If A359194(x) = a(k) for some a(k) < x, then x is also in the sequence.
(2) The orbit of any x under iterations of A359194 is finite if and only if it reaches a term of this sequence.
(3) No term has binary digits starting with '11...', i.e., all terms > 1 have binary digits starting '10...'.
(4) If the 3rd binary digit of a(n) is a '1', it cannot be followed by another bit 1, so all terms > 5 have a binary representation of the form '100...' or '1010...'
(5) A substring of '11', i.e., two consecutive bits 1, in a term of this sequence, is necessarily preceded by an earlier substring '00', i.e., two consecutive bits 0 to the left of the '11'. [This implies (3) and (4).] (End)

Examples

			40 is a term since its trajectory is 40 -> 7 -> 10 -> 1 -> 0, which never exceeds 40.
		

Crossrefs

Programs

  • Maple
    bc:= n -> 2^(1+ilog2(n))-1-n: bc(0):= 1:
    filter:= proc(n) local x;
      x:= n;
      while x <> 0 do
        x:= bc3(x);
        if x > n then return false fi;
      od;
      true
    end proc:
    select(filter, [$0..1000]); # Robert Israel, Dec 22 2022
  • Mathematica
    f[n_] := BitXor[3 n, 2^IntegerPart[Log2[3 n] + 1] - 1]; Select[Range[0, 200], Function[n, AllTrue[NestWhileList[f, n, # != 0 &], # <= n &]]] (* Michael De Vlieger, Dec 21 2022 *)
  • PARI
    f(n) = if(n, bitneg(n, exponent(n)+1), 1); \\ A035327
    isok(m) = my(km=m); while (m, m=f(3*m); if (m>km, return(0))); return(1); \\ Michel Marcus, Dec 21 2022
  • Python
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def ok(n):
        i, fi, m = 0, n, n
        while fi != 0 and m <= n: i, fi, m = i+1, f(fi), max(m, fi)
        return m <= n
    print([k for k in range(580) if ok(k)]) # Michael S. Branicky, Dec 20 2022
    

A359215 Number of terms in S(n) that did not appear in previous trajectories, where S(n) is the trajectory of the mappings of x->A359194(x) starting with n and stopping when 0 is reached, -1 if 0 is never reached.

Original entry on oeis.org

0, 1, 1, 11, 1, 1, 0, 2, 1, 1, 0, 6, 78, 0, 2, 0, 0, 1, 0, 1, 1, 0, 0, 3, 0, 0, 11, 0, 7571, 2, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 3, 0, 3, 77, 0, 5419, 1, 0, 1, 4, 0, 1, 0, 0, 2, 2, 0, 2, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1
Offset: 0

Views

Author

Michael De Vlieger, Dec 21 2022

Keywords

Comments

"Branch length" of n->A359194(n).
a(0) = 0 since n = 0.
Let m be the first term in S(n) that has appeared in S(k), k < n. A359218(n) = m.
Analogous to A222118 which instead regards the Collatz function A006318.

Examples

			a(0) = 0 since n = 0.
a(1) = 1 since S(1) = {1, 0}, but m = 0 appeared in S(0).
a(2) = 1 since S(2) = {2, 1, 0}, but m = 1 appeared in S(1).
a(3) = 11 since S(3) = {3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0}, but m = 0 appeared in S(0).
a(4) = 1 since S(4) = {4, 3, ...} but 3 appears in S(3), etc.
		

Crossrefs

Programs

  • Mathematica
    c[] = -1; c[0] = 0; f[n] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Table[(Map[If[c[#1] == -1, Set[c[#1], #2]] & @@ # &, Partition[#, 2, 1]]; -1 + Length[#]) &@ NestWhileList[f, n, c[#] == -1 &], {n, 0, 120}]

A359218 Let S(n) be the sequence obtained through the mapping of x->A359194(x) starting with n and stopping when 0 is reached, -1 if 0 is never reached. a(n) = m if appears in S(k), k < n, otherwise -1.

Original entry on oeis.org

0, 0, 1, 0, 3, 0, 6, 1, 7, 4, 10, 9, 10, 13, 0, 15, 16, 12, 18, 6, 3, 21, 22, 12, 24, 25, 3, 27, 21, 7, 30, 31, 31, 28, 34, 22, 19, 37, 13, 39, 40, 4, 1, 43, 123, 58, 46, 4, 187, 49, 27, 102, 52, 96, 42, 55, 87, 57, 58, 21, 30, 61, 48, 63, 64, 60, 66, 54, 51, 69
Offset: 0

Views

Author

Michael De Vlieger, Dec 21 2022

Keywords

Comments

By convention, a(0) = 0 since n = 0.
Regarding A359215(n), this is the value m that had appeared in S(k), k < n.

Examples

			a(1) = 0 since S(1) = {1, 0}, but m = 0 appeared in S(0).
a(2) = 1 since S(2) = {2, 1, ...}, but m = 1 appeared in S(1).
a(3) = 0 since S(3) = {3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0}, but m = 0 appeared in S(0).
a(4) = 3 since S(4) = {4, 3, ...} but 3 appears in S(3), etc.
a(5) = 0 since S(5) = {5, 0}, but 0 appears in S(0).
a(6) = 6 since 6 appears in F(3).
a(7) = 1 since S(7) = {7, 10, 1, ...} but 1 appears in S(1).
a(8) = 7 since S(8) = {8, 7, ...} but 7 appears in S(7)
a(9) = 4 since S(9) = {9, 4, ...} but 4 appears in S(4).
a(10) = 10 since 10 appears in S(7).
a(11) = 9 since S(11) = {11, 30, 37, 16, 15, 18, 9, ...} but 9 appears in S(9).
a(12) = 10 since S(12) = {12, 27, ..., 39, 10, ...} but 10 appears in S(7), etc.
		

Crossrefs

Programs

  • Mathematica
    c[] = -1; c[0] = 0; f[n] := BitXor[3 n, 2^IntegerPart[Log2[3 n] + 1] - 1]; Table[(Map[If[c[#1] == -1, Set[c[#1], #2]] & @@ # &, Partition[#, 2, 1]]; Last@ #) &@ NestWhileList[f, n, c[#] == -1 &], {n, 0, 120}]

A359255 Number of steps to reach a maximum starting with n in the map x->A359194(x) (binary complement of 3n), or -1 if n goes to infinity.

Original entry on oeis.org

0, 0, 0, 7, 8, 0, 6, 1, 2, 9, 0, 15, 28, 5, 1, 11, 12, 29, 10, 7, 8, 0, 2, 31, 4, 21, 5, 27, 2962, 1, 14, 23, 24, 2963, 22, 3, 8, 13, 6, 0, 0, 9, 0, 2961, 2, 33, 26, 11, 74, 4, 1591, 69, 20, 5, 3, 3, 34, 9, 30, 1, 16, 1, 76, 11
Offset: 0

Views

Author

Hans Havermann, Dec 22 2022

Keywords

Comments

The corresponding maxima reached are in A359208. The indices at which zeros appear here are in A359209.

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Table[c=m=0; n=r=i; While[n!=0, c++; n=f[n]; If[n>r, m=c; r=n]]; m, {i, 0, 63}]
  • Python
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def a(n):
        i, fi, m, mi = 0, n, n, 0
        while fi != 0:
            i, fi = i+1, f(fi)
            if fi > m: m, mi = fi, i
        return mi
    print([a(n) for n in range(64)]) # Michael S. Branicky, Dec 22 2022

A359219 Starting numbers that require more iterations of the map x->A359194(x) (binary complement of 3n) to reach 0 than any smaller number.

Original entry on oeis.org

0, 1, 2, 3, 4, 9, 11, 12, 17, 23, 28, 33, 74, 86, 180, 227, 350, 821, 3822, 4187, 5561, 6380, 6398, 22174, 22246, 26494, 34859, 49827, 70772, 103721, 104282, 204953, 213884, 225095, 407354, 425720
Offset: 1

Views

Author

Joshua Searle, Dec 21 2022

Keywords

Comments

425720 after 10^10 iterations has not yet reached 0 and in general it is unknown whether every starting number does reach 0.
A359207(425720) = 87037147316. - Martin Ehrenstein, Jan 02 2023

Examples

			3 is a term because it requires 11 iterations to reach 0, which is more than any starting number less than 3.
0: (0) -- 0 terms
1: (1, 0) -- 1 term
2: (2, 1, 0) -- 2 terms
3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 terms.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def iters(n):
        i, fi = 0, n
        while fi != 0: i, fi = i+1, f(fi)
        return i
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v = iters(m)
            if v > record: yield m; record = v
    print(list(islice(agen(), 18))) # Michael S. Branicky, Dec 21 2022

Extensions

a(27)-a(36) from Tom Duff (SeqFan mailing list, Dec 19 2022)

A359220 Number of steps to reach 0 from A359219(n) where A359219 are the starting numbers that require more iterations in the map x->A359194(x) than any smaller number.

Original entry on oeis.org

0, 1, 2, 11, 12, 13, 19, 80, 81, 83, 7572, 7573, 7574, 7578, 7580, 664475, 664882, 3180929, 3180930, 3180931, 3181981, 3181988, 3182002, 3182226, 120796790, 556068798, 556068799, 556068871, 556068872, 572086553, 572086610, 1246707529, 1246707552, 1246707555, 1246707602
Offset: 1

Views

Author

Joshua Searle, Dec 21 2022

Keywords

Comments

It is unknown whether all starting numbers reach 0; the next term, a(36) depends on whether 425720 ever reaches 0 (see A359207). It remains nonzero after 10^10 iterations.
A359207(425720) = 87037147316. Calculated by Tom Duff (12/16/22) - Joshua Searle, Jan 10 2023
a(4) - a(7) only differ by a small fraction of their starting terms. The same is true for the terms in the intervals a(8) - a(10), a(11) - a(15), a(16) - a(17) and a(18) - a(24). It may also be true for a(26) - a(29), a(30) - a(31) and a(32) - a(35).

Examples

			a(4) is the step count from the starting number A359219(4) = 3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 steps, hence a(4) = 11.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def iters(n):
        i, fi = 0, n
        while fi != 0: i, fi = i+1, f(fi)
        return i
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v = iters(m)
            if v > record: yield v; record = v
    print(list(islice(agen(), 18))) # Michael S. Branicky, Dec 21 2022

Extensions

a(27) and beyond from Tom Duff (SeqFan mailing list, Dec 19 2022)

A359221 Starting numbers which reach a new record high value when iterating the map x->A359194(x) (binary complement of 3n).

Original entry on oeis.org

0, 1, 2, 3, 12, 28, 227, 821, 22246, 26494, 204953, 425720
Offset: 1

Views

Author

Joshua Searle, Dec 22 2022

Keywords

Comments

It is unknown whether all starting numbers reach 0.
103721 is not a term of this sequence despite having a trajectory of record length, because its maximum of 2.42...*10^14081 is lower than the previous record holder.

Examples

			Let S(x) = iteration sequence of A359194 starting with x; then
S(0) = (0), maximum = 0;
S(1) = (1, 0), maximum = 1;
S(2) = (2, 1, 0), maximum = 2;
S(3) = (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0), maximum = 300;
Since S(3) contains a higher maximum than any lower positive starting integer, 3 is a term of this sequence.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def itersmax(n):
        i, fi, m = 0, n, n
        while fi != 0: i, fi, m = i+1, f(fi), max(m, fi)
        return i, m
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v, mx = itersmax(m)
            if mx > record:
                yield m # use mx to obtain values
                record = mx
    print(list(islice(agen(), 8))) # Michael S. Branicky, Dec 22 2022

A359222 Number of steps to reach 0 from A359221(n) (Starting numbers that reach a new record high value during iteration by the map x->A359194(x)).

Original entry on oeis.org

0, 1, 2, 11, 80, 7572, 664475, 3180929, 120796790, 556068798, 1246707529, 87037147316
Offset: 1

Views

Author

Joshua Searle, Dec 29 2022

Keywords

Comments

a(12) found by Tom Duff (26 Dec 2022).
It is unknown whether all starting numbers reach 0.

Examples

			a(4) is the step count from the starting number A359221(4) = 3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 steps, hence a(4) = 11.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def itersmax(n):
        i, fi, m = 0, n, n
        while fi != 0: i, fi, m = i+1, f(fi), max(m, fi)
        return i, m
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v, mx = itersmax(m)
            if mx > record:
                yield v # use m to obtain starting numbers
                record = mx
    print(list(islice(agen(), 8))) # Michael S. Branicky, Dec 29 2022
Showing 1-10 of 16 results. Next