Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 146
def isquare (n): if isqrt(n) ** 2 == n: return(True) return(False) def isqrt(n): return int(floor(sqrt(n))) def usqrt (n): ur = isqrt(n) if ur ** 2 < n: ur = ur + 1 return(ur) def OneLine (n, iter): for x in range(1, iter + 1): sq = usqrt(x * n) y = sq ** 2 % n if isquare(y) == True: t = isqrt(y) u = gcd(n, sq - t) print("Factor found in round {0} rounds".format(x)) return(u) print("No factors found")
OneLine(next_prime(113)*next_prime(129),100)
('Factor found in round %d rounds\n', 1) 127