本文整理匯總了Python中Euler.miller_rabin方法的典型用法代碼示例。如果您正苦於以下問題:Python Euler.miller_rabin方法的具體用法?Python Euler.miller_rabin怎麽用?Python Euler.miller_rabin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Euler
的用法示例。
在下文中一共展示了Euler.miller_rabin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: factors
# 需要導入模塊: import Euler [as 別名]
# 或者: from Euler import miller_rabin [as 別名]
current_max_num_factors = 0
list_of_highly_composite_numbers = []
list_of_highly_composite_num_factors = []
while 1:
# if i>1000:
# break
i += 1
# print i, Euler.miller_rabin(i)
# make sure not a prime first since we know primes only have 2 factors ( 1 and i ). will short circuit on primes
if ( not Euler.miller_rabin(i) ): # if it is a composite number
nf = dlibrary.find_number_of_factors_fast(i)
if ( nf > current_max_num_factors ):
current_max_num_factors = nf
print "%60d %30d" % (i, nf)
# list_of_highly_composite_numbers.append( i )
# list_of_highly_composite_num_factors.append( nf )
# for n in range(0,len(list_of_highly_composite_numbers)):
# print "%10d %10d" % (list_of_highly_composite_numbers, list_of_highly_composite_num_factors)