[英]Program trapped in long loop - how to exit?
我正在编写一个程序,该程序找到一个数的两个主要因素。 (用于我的rsa解密作业)
我刚开始使用Python,所以我是一个初学者,我在发现因素后不理解为什么该程序无法正常工作。
p
和q
是因子数字,ı是在计算程序后手动编写的。
我想打印totientfonk
但不能。 程序不会顺便关闭。 它只是在等待。
nsayisi = 27765438273271
for i in range(2,nsayisi):
if nsayisi % i == 0:
print(i)
p = 4812569
q = 5769359
totientfonk = (p-1) * (q-1)
print(totientfonk)
这是您要做什么?
nsayisi = 27765438273271
for p in range(2, nsayisi):
if nsayisi % p == 0:
q = nsayisi // p
break
print(p, q)
totientfonk = (p - 1) * (q - 1)
print(totientfonk)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.