借助于sympy.reduced_totient()方法,我们可以在SymPy中找到Carmichael简化的totient函数或lambda(n)。 reduced_totient(n)或
是最小的m> 0这样
对所有人ķ相对于ñ。
用法: reduced_totient(n)
参数:
n - 它表示一个整数。
返回:返回最小整数m> 0,使km对于相对于n的所有k,%n等于1。
范例1:
# import reduced_totient() method from sympy 
from sympy.ntheory import reduced_totient 
  
n = 8
  
# Use reduced_totient() method  
reduced_totient_n = reduced_totient(n)  
      
print("lambda({}) =  {} ".format(n, reduced_totient_n))  
# 1 ^ 2 = 1 (mod 8), 3 ^ 2 = 9 = 1 (mod 8), 
# 5 ^ 2 = 25 = 1 (mod 8) and 7 ^ 2 = 49 = 1 (mod 8)输出:
lambda(8) = 2
范例2:
# import reduced_totient() method from sympy 
from sympy.ntheory import reduced_totient 
  
n = 30
  
# Use reduced_totient() method  
reduced_totient_n = reduced_totient(n)  
      
print("lambda({}) =  {} ".format(n, reduced_totient_n)) 输出:
lambda(30) = 4
相关用法
- Python os.dup()用法及代码示例
 - Python next()用法及代码示例
 - Python set()用法及代码示例
 - Python object()用法及代码示例
 - Python bytes()用法及代码示例
 - Python os.times()用法及代码示例
 - Python os.chmod用法及代码示例
 - Python hash()用法及代码示例
 - Python os.ftruncate()用法及代码示例
 - Python os.truncate()用法及代码示例
 - Python os.fsdecode()用法及代码示例
 - Python dict pop()用法及代码示例
 - Python os.abort()用法及代码示例
 - Python os.WEXITSTATUS()用法及代码示例
 
注:本文由纯净天空筛选整理自rupesh_rao大神的英文原创作品 Python | sympy.reduced_totient() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
