Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 PARI/GP找到给定素数p除以数字的最高幂?N
p
N
例如。如果我们有p = 7并且N = 3087我们得到e = 3了p^e | N但p^(e+1)没有分裂N。
p = 7
N = 3087
e = 3
p^e | N
p^(e+1)
我想避免数字的完全分解N。
使用valuation命令,如下所示:
valuation
valuation(3087, 7)
这不计算数字的分解。
或者,您可以编写自己的函数:
val(n, p)= { if(n==0, return(+oo)); my(e); while(n%p==0, n /= p; e++ ); e; }