REDUCEDTOT

This function computes Carmichael’s reduced totient function \lambda(n), the smallest positive exponent that maps all units modulo n to 1.

\lambda(n) = \min\{m \in \mathbb{N} : a^m \equiv 1 \pmod{n}\ \text{for all } a\ \text{with } \gcd(a,n)=1\}

It is also known as the exponent of the multiplicative group modulo n and is used in modular arithmetic analysis.

Excel Usage

=REDUCEDTOT(n)
  • n (int, required): Positive integer input.

Returns (int): Carmichael reduced totient value of the input integer.

Example 1: Reduced totient of one

Inputs:

n
1

Excel formula:

=REDUCEDTOT(1)

Expected output:

1

Example 2: Reduced totient of power of two

Inputs:

n
16

Excel formula:

=REDUCEDTOT(16)

Expected output:

4

Example 3: Reduced totient of a composite integer

Inputs:

n
30

Excel formula:

=REDUCEDTOT(30)

Expected output:

4

Example 4: Reduced totient of odd composite integer

Inputs:

n
45

Excel formula:

=REDUCEDTOT(45)

Expected output:

12

Python Code

from sympy import reduced_totient as sympy_reduced_totient

def reducedtot(n):
    """
    Compute Carmichael's reduced totient function for an integer.

    See: https://docs.sympy.org/latest/modules/functions/combinatorial.html#sympy.functions.combinatorial.numbers.reduced_totient

    This example function is provided as-is without any representation of accuracy.

    Args:
        n (int): Positive integer input.

    Returns:
        int: Carmichael reduced totient value of the input integer.
    """
    try:
        if isinstance(n, bool):
            return "Error: n must be an integer"

        n_value = int(n)
        if float(n) != float(n_value):
            return "Error: n must be an integer"
        if n_value <= 0:
            return "Error: n must be positive"

        return int(sympy_reduced_totient(n_value))
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Positive integer input.