Carmichael lambda function: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
→‎{{header|Wren}}: Optimized - significantly quicker than before.
Wherrera (talk | contribs)
m sp
Line 4:
;Background
 
The '''Carmichael function''', or '''Carmichael lambda function''', is a function in numericnumber theory. The Carmichael lambda {{math | ''λ''(''n'')}} of a positive integer '''n''' is the smallest positive integer '''m''' such that
:<math>a^m \equiv 1 \pmod{n}</math>
holds for every integer coprime to '''n'''.
Line 32:
 
=={{header|Python}}==
Python has the Carmichael function in the SymPy library, where isit is called reduced_totient.
<syntaxhighlight lang="Python">from sympy import reduced_totient
 
Line 52:
 
UP_TO = 20
MAX_TO_TEST = 1_000_000_000100_000_000_000
FIRSTS = [0] * (UP_TO + 1)
FIRSTS[0] = 1