【发布时间】:2013-08-04 18:08:02
【问题描述】:
我正在尝试找到解决方案的数量
x^a (mod b) =c with 0<=x<=u
其中 b
(x^a + y^a) (mod b)=c
我可以生成所有无序的 x 和 y 对,使得 x
t={i+i*(i-1)*2 if x=y , i*j*2 if x!=y }
对 t 求和。我想知道我的算法是否正确,是否还有其他更有效的算法。
【问题讨论】:
-
是的,您的第一个算法是正确的,正如以下对类似问题的回答所示:stackoverflow.com/a/18042254/509868
标签: algorithm math discrete-mathematics number-theory modular-arithmetic