冬天地上扑的是雪,厚厚的,软软的;房上落的是雪,白皑皑的,又松又软;树上盖的是雪,积雪把树枝压弯了腰。太阳照在雪山上,发出耀眼的光芒。
本文实例讲述了Python判断Abundant Number的方法。分享给大家供大家参考。具体如下:
Abundant Number,中文译成:盈数(又称 丰数, 过剩数abundant number)是一种特殊的 自然数,除去它本身以外的一切正约数的和大于它本身。
介绍见百度百科: http://baike.baidu.com/view/1596350.htm
#Checks if a number is abundant or not
#An abundant number is the number of which sum of
#factors(including itself) is greater than twice the number
def abundant(n):
sum_factors=0
for i in range(1,n+1):
if n%i==0:
#finds out the factors
f=i
sum_factors += f
if sum_factors>2*n:
#condition for abundant number
print "This is an Abundant Number!"
else:
print "This is not an Abundant Number!"
希望本文所述对大家的Python程序设计有所帮助。
以上就是Python判断Abundant Number的方法。死亡并不可怕,可怕的是,你辜负了所有人的眼泪,辜负了自己直到生命结束也未曾达到的高度,还有那未曾完成的梦想。更多关于Python判断Abundant Number的方法请关注haodaima.com其它相关文章!