-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (37 loc) · 1.12 KB
/
main.py
File metadata and controls
47 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
"""
Legacy entry point - use the factorization package directly instead.
Example:
from factorization import factorize, factorize_full
p, q = factorize(n)
factors = factorize_full(n)
Or use the CLI:
python -m factorization 1234567 --verbose
"""
from factorization import factorize, factorize_full, is_prime
def main():
print("Integer Factorization Suite")
print("=" * 50)
print()
print("Use the factorization package directly:")
print(" from factorization import factorize")
print(" p, q = factorize(n)")
print()
print("Or use the CLI:")
print(" python -m factorization 1234567 --verbose")
print()
# Quick demo
test_numbers = [
15, # 3 × 5
143, # 11 × 13
10403, # 101 × 103
1000003 * 1000033, # 13-digit semiprime
]
print("Quick demo:")
print("-" * 50)
for n in test_numbers:
p, q = factorize(n)
status = "✓" if p * q == n and p > 1 and q > 1 else "✗"
print(f"{n} = {p} × {q} {status}")
if __name__ == "__main__":
main()