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
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.
-
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 *)
-
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
-
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
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
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.
-
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
a(27)-a(36) 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
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.
Cf.
A035327,
A359194,
A359207,
A359208,
A359209,
A359215,
A359218,
A359219,
A359220,
A359222,
A359255.
-
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
Showing 1-3 of 3 results.
Comments