有没有更快的方法来找到600851475143的主要因数?
我的计算机仍然无法产生答案。这是我的代码:
import sympy
num = 600851475143
list(filter(lambda x: sympy.isprime(x) and num % x ==0,range(2,600851475143 +1))
答案 0 :(得分:0)
这立即返回:
hrly_df = {'dateTime': ['2019-05-21 01:00:00', '2019-05-21 02:00:00', '2019-05-21 03:00:00', '2019-05-21 01:00:00', '2019-05-21 02:00:00'],
'field id': [40238, 40238, 40238, 3402, 3402],
'HourlyPrecipIn': [0.0, 0.0, 0.0, 0.0, 0.0],
'HourlyRH': [73.8, 77.0, 79.9, 73.9, 77.1],
'HourlyTempF': [48.4, 46.8, 47.0, 48.4, 46.8]}
hrly_df = pd.DataFrame(hrly_df)
# Gets you max 'HourlyTempF' per 'field id'
temp_max = hrly_df[['field id', 'HourlyTempF']].groupby('field id').max()
# Gets you min 'HourlyTempF' per 'field id'
temp_min = hrly_df[['field id', 'HourlyTempF']].groupby('field id').min()
# Gets you sum of 'HourlyPrecipIn' per 'field id'
precip_sum = hrly_df[['field id', 'HourlyPrecipIn']].groupby('field id').sum()
print(temp_max)
print(temp_min)
print(precip_sum)
所以
In [17]: import sympy
In [18]: sympy.factorint(600851475143)
Out[18]: {71: 1, 839: 1, 1471: 1, 6857: 1}