本文整理汇总了Python中sage.all.ZZ.gcd方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.gcd方法的具体用法?Python ZZ.gcd怎么用?Python ZZ.gcd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.all.ZZ
的用法示例。
在下文中一共展示了ZZ.gcd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aplist
# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import gcd [as 别名]
def aplist(E, B=100):
"""
Compute aplist for an elliptic curve E over Q(sqrt(5)), as a
string->number dictionary.
INPUT:
- E -- an elliptic curve
- B -- a positive integer (default: 100)
OUTPUT:
- dictionary mapping strings (labeled primes) to Python ints,
with keys the primes of P with norm up to B such that the
norm of the conductor is coprime to the characteristic of P.
"""
from psage.modform.hilbert.sqrt5.tables import canonical_gen
v = {}
from psage.modform.hilbert.sqrt5.sqrt5 import F
labels, primes = labeled_primes_of_bounded_norm(F, B)
from sage.all import ZZ
N = E.conductor()
try:
N = ZZ(N.norm())
except:
N = ZZ(N)
for i in range(len(primes)):
p = primes[i]
k = p.residue_field()
if N.gcd(k.cardinality()) == 1:
v[labels[i]] = int(k.cardinality() + 1 - E.change_ring(k).cardinality())
return v