Skip to content

Main content

Recurrence Term Modulus Step

Evaluate one explicit affine integer recurrence step modulo a supplied positive modulus with exact multiplication.

Loading tool…

Description

Calculate one exact modular affine recurrence step.

Sequence calculations depend on the reference index, common difference or ratio, and whether a domain uses exact integers or real-valued arithmetic. Alternation depends on index parity; modular arithmetic chooses a representative in a fixed residue interval. A supplied local rule is not discovered from data and need not establish a complete recurrence or prediction model.

Calculate one exact modular affine recurrence step.

When to use this tool

Use Recurrence Term Modulus Step when you already have previous, multiplier, increment, modulus and need to calculate one exact modular affine recurrence step.

How to use the tool and how it works

  1. Enter previous, multiplier, increment, modulus. 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 nextResidue. Use the output convention below.

Require signed safe whole previous/multiplier/increment and positive safe whole modulus. Compute (previous*multiplier+increment) mod modulus with BigInt, adding modulus to a negative remainder.1

Input fieldMeaning and unitsAccepted input
previousPreviousRequired. Safe integer.
multiplierMultiplierRequired. Safe integer.
incrementIncrementRequired. Safe integer.
modulusModulusRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
nextResidueExact whole residue in [0,modulus), with negative remainder normalized.Required. Safe integer.
json
{
  "input": {
    "previous": 7,
    "multiplier": 5,
    "increment": 3,
    "modulus": 11
  },
  "output": {
    "nextResidue": 5
  }
}

Limitations and assumptions

  • The result lies in [0,modulus); a single recurrence step does not establish period, statistical quality or secure randomness.
  • 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 the complete sequence definition and initial conditions for recurrence analysis. Choose exact integer or rational arithmetic when large indices or exact terms matter; local reference shifts and residue operations do not discover a generating rule.

References

  1. Calculation and input contract: sequence/recurrence-term-modulus-step — tool.io

Similar or alternative tools