|
发表于 2022-1-30 10:17:48
|
显示全部楼层
探测该数的所有因数:
- s=s1=600851475143
- a=[]
- def iss(n):
- if n==1:return 0
- for x in range(2,n):
- if n%x==0:
- return 0
- return 1
- for x in range(1,10001):
- if iss(x):a.append(x)
- b=[]
- for y in a:
- if s%y==0:
- s//=y
- b.append(y)
- import itertools
- m=[]
- for x in range(1,len(b)+1):
- m.extend(list(itertools.combinations(b,x)))
- xh=1
- print("%2d: %12d = %d * %d"%(xh,s1,1,s1))
- for x in m:
- t=1
- for y in x:
- t*=y
- xh+=1
- print("%2d: %12d = %d * %d"%(xh,s1,t,s1//t))
- '''
- PS C:\Users\Administrator> & C:/Programs/Python/python.exe d:/wp/test7.py
- 1: 600851475143 = 1 * 600851475143
- 2: 600851475143 = 71 * 8462696833
- 3: 600851475143 = 839 * 716151937
- 4: 600851475143 = 1471 * 408464633
- 5: 600851475143 = 6857 * 87625999
- 6: 600851475143 = 59569 * 10086647
- 7: 600851475143 = 104441 * 5753023
- 8: 600851475143 = 486847 * 1234169
- 9: 600851475143 = 1234169 * 486847
- 10: 600851475143 = 5753023 * 104441
- 11: 600851475143 = 10086647 * 59569
- 12: 600851475143 = 87625999 * 6857
- 13: 600851475143 = 408464633 * 1471
- 14: 600851475143 = 716151937 * 839
- 15: 600851475143 = 8462696833 * 71
- 16: 600851475143 = 600851475143 * 1
- PS C:\Users\Administrator>
- '''
复制代码 |
|