有没有办法将 for 循环嵌套在 Pari/GP (2.7.6) 中的其他 for 循环中,因为总是出现以下错误:
*** at top-level: read("prog.txt")
*** ^----------------
*** read: sorry, embedded braces (in parser) is not yet implemented.
代码:
(12:14) gp > n = 12
%12 = 12
(12:14) gp > k = 10
%13 = 10
(12:14) gp > g = [1..10]
%14 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
{
forprime(p = 1, 16,
rn = n%p
rk = k%p
{
for(i=1, #g,
if( (rn*(g[i]+rk)+1)%p!=0,
h = concat(h, g[i])
}
g = h
}
感谢帮助。我发布并从中获取代码的问题被删除了,所以我有点卡在这一点上。