文件名称:亲密数
- 所属分类:
- Linux/Unix编程
- 资源属性:
- [Text]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- 姚**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
如果整数A的全部因子(包括1,不包括A本身)之和等于B;且整数B的全部因子(包括1,不包括B本身)之和等于A,则将整数A和B称为亲密数。求3000以内的全部亲密数。
*题目分析与算法设计
按照亲密数定义,要判断数a是否有亲密数,只要计算出a的全部因子的累加和为b,再计算b的全部因子的累加和为n,若n等于a则可判定a和b是亲密数。计算数a的各因子的算法:
用a依次对i(i=1~a/2)进行模运算,若模运算结果等于0,则i为a的一个因子;否则i就不是a的因子。
*-If all integral factor (including one, including the A itself) the sum equivalent to B; But all integral factor B (1, B itself) is the sum of A, will be rounded A and B as a few intimate. For all of 3000 within a few intimate.* Subject algorithm design and analysis in accordance with the closest definition, in determining whether there are a few close a number calculated as a factor in all of the cumulative and b, b calculate all the factors and the accumulation of n, n if convicted could mean a and b are a few intimate. Calculations of a factor in the algorithm : a right turn i (i = 1 ~ a/2) modulo, if modulo results equal to 0, i for one of a factor; I would otherwise not a factor.*
*题目分析与算法设计
按照亲密数定义,要判断数a是否有亲密数,只要计算出a的全部因子的累加和为b,再计算b的全部因子的累加和为n,若n等于a则可判定a和b是亲密数。计算数a的各因子的算法:
用a依次对i(i=1~a/2)进行模运算,若模运算结果等于0,则i为a的一个因子;否则i就不是a的因子。
*-If all integral factor (including one, including the A itself) the sum equivalent to B; But all integral factor B (1, B itself) is the sum of A, will be rounded A and B as a few intimate. For all of 3000 within a few intimate.* Subject algorithm design and analysis in accordance with the closest definition, in determining whether there are a few close a number calculated as a factor in all of the cumulative and b, b calculate all the factors and the accumulation of n, n if convicted could mean a and b are a few intimate. Calculations of a factor in the algorithm : a right turn i (i = 1 ~ a/2) modulo, if modulo results equal to 0, i for one of a factor; I would otherwise not a factor.*
(系统自动生成,下载前可以参看下载内容)
下载文件列表
亲密数.txt