# Carmichael Function λ(n) Calculator

Group exponent λ(n) from prime factorization with φ(n) comparison, primitive-root existence, Korselt's Carmichael-number detection, and optional sample-unit verification.

> Canonical page: https://elysiatools.com/en/tools/carmichael-function

- **Category:** Math & Numbers

- **Keywords:** carmichael function, lambda function, exponent of group, multiplicative group, carmichael number, korselt criterion, primitive root, number theory

## Overview

The Carmichael Function λ(n) Calculator determines the universal exponent of the multiplicative group modulo n from its prime factorization. It computes per-prime-power exponents, compares the resulting group exponent λ(n) against Euler's totient φ(n), determines whether a primitive root exists, checks Korselt's criterion for Carmichael numbers, and optionally verifies modular congruences against sample coprime units.

## Inputs

- **Number n** (text): Positive integer, 1 ≤ n ≤ 10¹² (trial-division factorization bound).
- **Output detail** (select)

## When to use

- Finding the minimal universal exponent λ(n) such that a^λ(n) ≡ 1 (mod n) for all integers coprime to n.
- Checking whether a composite modulus is a Carmichael number via Korselt's criterion (λ(n) divides n − 1).
- Determining if a given modulus n possesses a primitive root by comparing λ(n) with Euler's totient φ(n).

## How it works

- Decomposes the input integer n into its prime power factorization p^k.
- Calculates component exponents using λ(2) = 1, λ(4) = 2, λ(2^k) = 2^(k−2) for k ≥ 3, and λ(p^k) = φ(p^k) for odd primes.
- Takes the least common multiple (lcm) of all component exponents to determine the overall group exponent λ(n).
- Compares λ(n) to φ(n), evaluates Korselt's criterion, and optionally verifies the congruence a^λ(n) ≡ 1 (mod n) with sample coprime bases.

## Use cases

- Optimizing cryptographic private exponents and analyzing modular arithmetic cycles in RSA architectures.
- Validating abstract algebra coursework involving multiplicative group structures, subgroup orders, and primitive roots.
- Analyzing Fermat pseudoprimes and verifying Carmichael number candidates in number theory research.

## Frequently asked questions

### What is the difference between Carmichael's λ(n) and Euler's φ(n)?

Euler's φ(n) is the order of the multiplicative group modulo n, while Carmichael's λ(n) is the smallest positive exponent satisfying a^λ(n) ≡ 1 (mod n) for all coprime integers a. λ(n) always divides φ(n) and is often smaller.

### When does an integer n have a primitive root?

A primitive root exists if and only if λ(n) = φ(n), which occurs solely when n is 1, 2, 4, p^k, or 2p^k for an odd prime p.

### How does the calculator identify a Carmichael number?

It tests Korselt's criterion: n must be composite, square-free, and satisfy the condition that λ(n) divides n − 1.

### What is the maximum supported input value for n?

The calculator supports positive integers n up to 10¹² using trial-division prime factorization.

### What does the sample-unit verification option do?

It generates coprime units modulo n and explicitly computes a^λ(n) mod n to verify that each result equals 1.

## Related tools

- [Chinese Remainder Theorem Solver (System of Congruences)](https://elysiatools.com/en/tools/chinese-remainder-theorem): Generalized pairwise-merge CRT for 2–20 congruences: coprime moduli give the product modulus, consistent non-coprime moduli give the lcm, inconsistent systems are rejected.
- [Permutation / Combination / Subset Generator (With Repeats)](https://elysiatools.com/en/tools/combinatorial-generation): Deduplicated, lexicographic permutations / combinations / subsets of up to 12 items with exact multiset counts; display capped at 200 entries.
- [Euler Totient Function φ(n) Calculator](https://elysiatools.com/en/tools/euler-totient-function): Exact φ(n) from trial-division factorization (n ≤ 10¹²) with optional coprime listing and Euler's theorem recall.
- [Fraction Decimal Converter](https://elysiatools.com/en/tools/fraction-decimal-converter): Convert between fractions and decimals with support for mixed numbers, improper fractions, and various decimal formats
- [Zero-Sum Game Solver (Saddle Point / Linear Programming)](https://elysiatools.com/en/tools/game-theory-zero-sum): Two-person zero-sum games: saddle-point test first, then mixed strategies from a single-phase simplex LP with dual shadow prices, verified by security-level checks.
- [Inverse Laplace Transform Calculator (Partial Fractions)](https://elysiatools.com/en/tools/inverse-laplace-calculator): Partial-fraction inverse Laplace transform for proper rational functions: root factorization (real + conjugate pairs), exact coefficient system, term-by-term inversion.
- [Laplace Transform Calculator (Table Lookup)](https://elysiatools.com/en/tools/laplace-transform-calculator): Table lookup of L{f(t)} for 14 standard pairs, with parameter substitution, region of convergence, derivation note, and optional numeric F(s₀) evaluation.
- [Multiplicative Order Calculator mod n (ordₙ(a))](https://elysiatools.com/en/tools/order-of-element-mod-n): Smallest k with a^k ≡ 1 (mod n) via φ(n) reduction: power table, minimality proof, cyclic subgroup , primitive-root and maximal-order flags.

## Samples

- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Rust Samples](https://elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion
