国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python判斷Abundant Number的方法

2020-02-23 01:35:38
字體:
來源:轉載
供稿:網友

本文實例講述了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 numberdef 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程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐都县| 许昌县| 阿城市| 宁德市| 景洪市| 马公市| 襄汾县| 刚察县| 锡林浩特市| 温州市| 平遥县| 仙桃市| 晋江市| 巴马| 增城市| 中卫市| 梅河口市| 百色市| 彩票| 南城县| 廉江市| 泉州市| 中超| 越西县| 河南省| 时尚| 河西区| 台州市| 班戈县| 东至县| 平凉市| 元阳县| 修武县| 德保县| 桦南县| 盐边县| 天津市| 太保市| 锡林郭勒盟| 陇南市| 日土县|