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.

A385150 Smallest starting x which reaches the Antihydra halting condition for the first time at 3*n+1 terms of the iteration x -> floor(3*x/2).

Original entry on oeis.org

1, 6, 10, 30, 24, 46, 14, 16, 1284, 2398, 1844, 1326, 1048, 466, 1822, 810, 5826, 856, 254, 2820, 42658, 1880, 21442, 1396, 414, 354130, 73370, 311112, 87492, 72154, 195408, 130272, 230286, 227214, 1668076, 927548, 2422042, 311516, 4138178, 1243802
Offset: 0

Views

Author

Roman Khrabrov, Jun 19 2025

Keywords

Comments

The terms in the iteration include the starting x itself.
The Antihydra halting condition is that the number of odd terms in the iteration exceeds twice the number of even terms.
This condition is met for the first time in an iteration when the number of odds = 2*evens + 1, which has a total of evens + odds == 1 (mod 3) and hence some 3*n+1 terms.
All odd x halt at 1 term (odds=1, evens=0), so a(n) is even for n >= 1.
a(n) always exists since the least significant 3*n+1 bits of x are in one to one correspondence with the parity pattern of the first 3*n+1 terms in its iteration, and there are A001764(n) parity patterns which halt at 3*n+1.
The Antihydra halting condition only ever activates for ~61.8% of all numbers (the golden ratio minus 1).
But the ultimate fate of various particular starting x values is unknown. For example x=2 doesn't halt in at least 1.5 million steps, and if it ever halts, it is certainly the smallest starting x at that point.

Examples

			For n=2, a(2) = 10 since x=10 iterates
   10 -> 15 -> 22 -> 33 -> 49 -> 73 -> 109
    E     O     E     O     O     O      O   parity
and it has first reached number of odds and evens satisfying odds = 2*evens + 1 at 3*n+1 = 7 terms (odds=5, evens=2). 10 is the smallest such number, so a(2) = 10.
Notice that a(2) != 5 because although its iteration 5, 7, 10, 15, 22, 33, 49 also has odds=5 and evens=2, this isn't its first point where it had odds = 2*evens + 1 (but rather back at just 1 term odds=1, evens=0).
		

Crossrefs

Cf. A032766 (hydra step), A001764.

Programs

  • C
    /* See links. */
  • Python
    def a(n):
        def calc_halting_steps(num, max_steps):
            b = 0
            for step in range(1, max_steps + 1):
                if num % 2 == 0:
                    b += 2
                else:
                    b -= 1
                num = (3 * num) // 2
                if b < 0:
                    return step
            return -1
        a_curr = 0
        while True:
            halting_steps = calc_halting_steps(a_curr, 3 * n + 1)
            if halting_steps == 3 * n + 1:
                return a_curr
            a_curr += 1