Skip to content

Main content

Number: Factorial Trailing Zero Base Factor Term Tool

Compute one Legendre prime valuation contribution to n! trailing zeros for an explicitly supplied prime factor and base multiplicity; does not factor a base.

Loading tool…

Description

Compute one Legendre prime valuation contribution to n! trailing zeros for an explicitly supplied prime factor and base multiplicity; does not factor a base.

Exact integer arithmetic and finite numeric arithmetic have different range limits. A safe integer number is bounded by +/-9007199254740991, while supported decimal-integer text can represent larger values. Division and remainder also need a signed convention: truncating quotients and Euclidean nonnegative remainders can give different results.

Compute one Legendre prime valuation contribution to n! trailing zeros for an explicitly supplied prime factor and base multiplicity; does not factor a base.

When to use this tool

Use Number: Factorial Trailing Zero Base Factor Term when you need this exact stated integer sign, bound, division, comparison, or factor component.

How to use the tool and how it works

  1. Enter factorialN, prime, basePrimeMultiplicity. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

For factorialN in 0..1e9, candidate prime in 2..1e6, and basePrimeMultiplicity in 1..128 verify primality by trial division. Sum floor(N/prime^k) through repeated quotient division into primeValuation and return trailingZeroContribution=floor(valuation/multiplicity) inside result.1

Input fieldMeaning and unitsAccepted input
factorialNFactorial NRequired. Safe integer.
primePrimeRequired. Safe integer.
basePrimeMultiplicityBase Prime MultiplicityRequired. Safe integer.
Output fieldInterpretationReturned shape
resultObject containing the calculated result members described below.Required. Object.
result.primeValuationPrime ValuationCalculated result member: number.
result.trailingZeroContributionOne prime factor's bound; full radix count takes the minimum across factors.Calculated result member: number.
json
{
  "input": {
    "factorialN": 10,
    "prime": 5,
    "basePrimeMultiplicity": 1
  },
  "output": {
    "result": {
      "primeValuation": 2,
      "trailingZeroContribution": 2
    }
  }
}

Limitations and assumptions

  • This is one prime factor's trailing-zero bound for a radix. A complete radix result takes the minimum across all prime factors; factorial digits and a full base factorization are not computed.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use exact decimal-integer tools when the range exceeds safe numeric integers. State the division, remainder, midpoint, and zero convention before combining results from different operations.

References

  1. Calculation and input contract: number/factorial-trailing-zero-base-factor-term — tool.io

Similar or alternative tools