Skip to content

CarmichaelLambda ​

The Carmichael function λ(n)\lambda(n): the exponent of the multiplicative group mod nn — the least mm with am≡1(modn)a^m\equiv1\pmod n for every aa coprime to nn.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageCarmichaelLambda✓
CarmichaelLambda(n)the exponent of (Z/n)×(\mathbb{Z}/n)^\times
SageMathcarmichael_lambda(n)SymPyreduced_totient(n)
Typed signatures
TypePackageApplies
(integer) -> integercompute-enginealways
(integer) -> integernumber-theoryreplaces compute-enginealways

Domain: Number theory

Details
  • compute-engine has this natively; the gap closed here is Wolfram's λ(−n)=λ(n)\lambda(-n)=\lambda(n) and threading over a list, which the native handler left unevaluated.
  • λ(n)∣φ(n)\lambda(n) \mid \varphi(n) always, and the two agree exactly when (Z/n)×(\mathbb{Z}/n)^\times is cyclic. See Totient.

Plot

Examples

Basic #

The exponent of the group of units mod 10 is 4

live ↗
InCarmichaelLambda(10)\mathrm{CarmichaelLambda}(10)Out44
Scope #

Listable

live ↗
InCarmichaelLambda([8,15])\mathrm{CarmichaelLambda}(\bigl\lbrack8, 15\bigr\rbrack)Out[2,4]\bigl\lbrack2, 4\bigr\rbrack

Negative n: λ(−n)=λ(n)\lambda(-n)=\lambda(n)

live ↗
InCarmichaelLambda(−100)\mathrm{CarmichaelLambda}(-100)Out2020

Listable over a Range

live ↗
InCarmichaelLambda(1..10)\mathrm{CarmichaelLambda}(1..10)Out[1,1,2,2,4,2,6,2,6,4]\bigl\lbrack1, 1, 2, 2, 4, 2, 6, 2, 6, 4\bigr\rbrack

The sign of the argument is ignored

live ↗
InCarmichaelLambda(−10)\mathrm{CarmichaelLambda}(-10)Out44

Threads over a list

live ↗
InCarmichaelLambda([2,4,7])\mathrm{CarmichaelLambda}(\bigl\lbrack2, 4, 7\bigr\rbrack)Out[1,2,6]\bigl\lbrack1, 2, 6\bigr\rbrack
Applications #

561 is a Carmichael number: λ(561)\lambda(561) leaves remainder 1

live ↗
In561 mod CarmichaelLambda(561)561\bmod\mathrm{CarmichaelLambda}(561)Out11

Smaller than φ(12)=4\varphi(12)=4: units mod 12 have exponent 2

live ↗
InCarmichaelLambda(12)\mathrm{CarmichaelLambda}(12)Out22
Properties #

If m∣nm\mid n then λ(m)∣λ(n)\lambda(m)\mid\lambda(n)

live ↗
In[8∣24,CarmichaelLambda(8)∣CarmichaelLambda(24)]\bigl\lbrack8\mid24, \mathrm{CarmichaelLambda}(8)\mid\mathrm{CarmichaelLambda}(24)\bigr\rbrackOut[True,True]\bigl\lbrack\mathrm{True}, \mathrm{True}\bigr\rbrack

a1+λ(n)≡a(modn)a^{1+\lambda(n)}\equiv a \pmod n for squarefree nn

live ↗
In31+CarmichaelLambda(17) mod 173^{1+\mathrm{CarmichaelLambda}(17)}\bmod17Out33

Every element's multiplicative order divides λ(n)\lambda(n)

live ↗
InMultiplicativeOrder(4,9)∣CarmichaelLambda(9)\mathrm{MultiplicativeOrder}(4, 9)\mid\mathrm{CarmichaelLambda}(9)OutTrue\mathrm{True}

The trivial case, λ(1)=1\lambda(1)=1

live ↗
InCarmichaelLambda(1)\mathrm{CarmichaelLambda}(1)Out11

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

The only unit mod 2 is 1, so λ(2)=1\lambda(2)=1

live ↗
InCarmichaelLambda(2)\mathrm{CarmichaelLambda}(2)Out11

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

For an odd prime pp, λ(p)=p−1\lambda(p) = p-1

live ↗
InCarmichaelLambda(3)\mathrm{CarmichaelLambda}(3)Out22

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Units mod 4 form a cyclic group of order 2

live ↗
InCarmichaelLambda(4)\mathrm{CarmichaelLambda}(4)Out22

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

λ(5)=4\lambda(5) = 4: the units mod 5 form a cyclic group

live ↗
InCarmichaelLambda(5)\mathrm{CarmichaelLambda}(5)Out44

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Multiplicative over coprime parts: lcm(1,2)=2\mathrm{lcm}(1,2)=2

live ↗
InCarmichaelLambda(6)\mathrm{CarmichaelLambda}(6)Out22

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

λ(n)\lambda(n) always divides φ(n)\varphi(n)

live ↗
InCarmichaelLambda(8)∣Totient(8)\mathrm{CarmichaelLambda}(8)\mid\mathrm{Totient}(8)OutTrue\mathrm{True}

Mod 7 there is a primitive root, so λ=φ=6\lambda = \varphi = 6

live ↗
InCarmichaelLambda(7)\mathrm{CarmichaelLambda}(7)Out66

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Powers of 2 above 4 fall short of φ\varphi: λ(8)=2\lambda(8)=2, not 4

live ↗
InCarmichaelLambda(8)\mathrm{CarmichaelLambda}(8)Out22

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Odd prime powers are cyclic, so λ(9)=φ(9)=6\lambda(9)=\varphi(9)=6

live ↗
InCarmichaelLambda(9)\mathrm{CarmichaelLambda}(9)Out66

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

λ(11)=10\lambda(11) = 10, the full order of the unit group

live ↗
InCarmichaelLambda(11)\mathrm{CarmichaelLambda}(11)Out1010

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

λ(13)=12\lambda(13) = 12: 2 is a primitive root mod 13

live ↗
InCarmichaelLambda(13)\mathrm{CarmichaelLambda}(13)Out1212

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Equals λ(7)=6\lambda(7)=6 since 2 contributes nothing

live ↗
InCarmichaelLambda(14)\mathrm{CarmichaelLambda}(14)Out66

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

lcm(λ(3),λ(5))=lcm(2,4)=4\mathrm{lcm}(\lambda(3),\lambda(5))=\mathrm{lcm}(2,4)=4

live ↗
InCarmichaelLambda(15)\mathrm{CarmichaelLambda}(15)Out44

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Power of 2 beyond 4: 2k−22^{k-2}, here 4

live ↗
InCarmichaelLambda(16)\mathrm{CarmichaelLambda}(16)Out44

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

λ(17)=16\lambda(17) = 16, a power of 2 for a Fermat prime

live ↗
InCarmichaelLambda(17)\mathrm{CarmichaelLambda}(17)Out1616

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

Edge values: negatives mirror positives, and 0 gives 0

live ↗
InCarmichaelLambda([−2,−1,0,1,2])\mathrm{CarmichaelLambda}(\bigl\lbrack-2, -1, 0, 1, 2\bigr\rbrack)Out[1,1,0,1,1]\bigl\lbrack1, 1, 0, 1, 1\bigr\rbrack

λ(lcm(m,n))\lambda(\mathrm{lcm}(m,n)) is the lcm of λ(m)\lambda(m) and λ(n)\lambda(n)

live ↗
In[lcm⁡(CarmichaelLambda([3,8])),CarmichaelLambda(lcm⁡(3,8))]\bigl\lbrack\operatorname{lcm}(\mathrm{CarmichaelLambda}(\bigl\lbrack3, 8\bigr\rbrack)), \mathrm{CarmichaelLambda}(\operatorname{lcm}(3, 8))\bigr\rbrackOut[[2,2],2]\bigl\lbrack\bigl\lbrack2, 2\bigr\rbrack, 2\bigr\rbrack

Zero is a degenerate input and gives 0

live ↗
InCarmichaelLambda(0)\mathrm{CarmichaelLambda}(0)Out00

Known value · Wolfram MathematicalFunctionData, CarmichaelLambda

About
Examples30
Checked againstWolfram Language 30 agreeSageMath 21 agree5 errorSymPy 21 agree4 errormathlib4 22 agree6 error
CrosswalkWolfram LanguageSageMathSymPy

Implementation

mappedsympypackages/oracle/src/mappings.ts

reduced_totient is SymPy's Carmichael function.

mappedsagepackages/oracle/src/mappings.ts
mappedmathlib4packages/oracle/src/mappings.ts

ArithmeticFunction.carmichael, the exponent of the multiplicative group mod n; natural n only.

See also: Totient, MultiplicativeOrder