Collatz Steps to One

Count full Collatz steps from a positive decimal integer to one using even n/2 and odd 3n+1, reporting a resource error if one is not reached within 10,000 steps.

Description

Collatz stopping time counts full even-halving and odd-tripling-plus-one steps until one is reached.

Collatz stopping time counts full even-halving and odd-tripling-plus-one steps until one is reached. This convention counts an odd step and any following halving as separate steps.1

The tool returns steps. The indexing and output conventions below determine how to read these values.

When to use Collatz Steps to One

Use this for the following task: Count full Collatz steps from a positive decimal integer to one using even n/2 and odd 3n+1, reporting a resource error if one is not reached within 10,000 steps. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Collatz Steps to One and understand its results

  1. Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
  2. Enter n according to the field table, then run the tool.
  3. Read steps. Use the stated units, indexing and interpretation of the numerical result.
  4. Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
Input fieldMeaningValue type and boundsRequirement
nPositive starting integerstring (integer/arbitrary); maximum text length 200; pattern ^[1-9][0-9]*$Required

Read a positive decimal string with BigInt and apply at most 10000 steps. Return zero immediately for a starting value of one.

if even: n←n/2; if odd: n←3n+1; stop when n=1

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
stepsFull Collatz steps to first reach oneinteger
json
{
  "input": {
    "n": "27"
  },
  "output": {
    "steps": 111
  }
}

Limitations and assumptions

Failure to reach one within the work limit is an iteration-limit error, not evidence of divergence. The tool does not prove the Collatz conjecture or return the trajectory.

Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.

Alternative or Complementary methods

Choose One Collatz 3n+1 Step when you need its operation: Return one full Collatz step for a positive decimal integer: n/2 when even and 3n+1 when odd, including 1→4 and an input limit of 200 characters. Choose Recamán Sequence Term for the complementary operation: Return a(0)=0 and a(n)=a(n−1)−n when that value is positive and unused, otherwise a(n−1)+n; the index is capped at 100,000.

Background reference: OEIS A006577.

References

  1. OEIS A006577 — OEIS Foundation

Similar or alternative tools

  • One Collatz 3n+1 Step

    Return one full Collatz step for a positive decimal integer: n/2 when even and 3n+1 when odd, including 1→4 and an input limit of 200 characters.

  • Recamán Sequence Term

    Return a(0)=0 and a(n)=a(n−1)−n when that value is positive and unused, otherwise a(n−1)+n; the index is capped at 100,000.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies