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.

Description

One Collatz step applies a parity-based rule to a positive integer.

One Collatz step applies a parity-based rule to a positive integer. Keeping it separate from stopping-time counting makes the transformation easy to inspect.1

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

When to use One Collatz 3n+1 Step

Use this for the following task: 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. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use One Collatz 3n+1 Step 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 value. Preserve exact decimal strings and the stated indexing or coefficient order.
  4. Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
Input fieldMeaningValue type and boundsRequirement
nPositive starting decimal integerstring (integer/arbitrary); maximum text length 200; pattern ^[1-9][0-9]*$Required

Parse the positive decimal string with BigInt, check its parity and return the exact next value as decimal text.

next(n)=n/2 if even, otherwise 3n+1

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

Output fieldMeaningValue type
valueNext Collatz termstring (integer/arbitrary)
json
{
  "input": {
    "n": "27"
  },
  "output": {
    "value": "82"
  }
}

Limitations and assumptions

The full rule maps one to four; it does not stop at one. Inputs are capped at 200 characters and no convergence or cycle claim is made.

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 Collatz Steps to One when you need its operation: 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. Choose nth Fibonacci Number for the complementary operation: Return F(n) exactly as a decimal string with F(0)=0 and F(1)=1; the index is capped at 100,000 for bounded computation.

Background reference: OEIS A006370.

References

  1. OEIS A006370 — OEIS Foundation

Similar or alternative tools

  • 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.

  • nth Fibonacci Number

    Return F(n) exactly as a decimal string with F(0)=0 and F(1)=1; the index is capped at 100,000 for bounded computation.

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