用Python来判断过剩数的方法示例,python过剩数示例,在用Python来判断过
用Python来判断过剩数的方法示例,python过剩数示例,在用Python来判断过
在用Python来判断过剩数的方法示例之前,要知道什么是过剩数。说到过剩数,应该是有很多人不理解它的概念。我更喜欢叫它为Abundant Number,它是一种特殊的自然数,它的特点是除去它本身以外的一切正约数的和大于它本身。
用Python来判断过剩数的方法示例,源码如下:
#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#www.iplaypy.comdef 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素数,python很多方
- python自动判读素数返回True/False方法,pythonfalse,素数检测
- Python完成计算三维矢量幅度的方法源码,python矢量,关于
- Python方法下载yahoo财经股市信息源码,python财经股市,
- WLST WebLogic服务器监控脚本,wlst服务器监控,这是之前在
- python方法备份桌面上非link文件,,python方法备份桌面
- 最简短的遍历显示当前目录树的python方法,当前目录树
- 抓取谷歌音乐搜索结果的python方法,谷歌python,抓取谷歌
- 一个简单的python刷新浪微博粉丝小程序,python小程序
- winmm实现调整windows系统音量大小的python方法,winmmpyth
评论关闭