java如果整数a的全部因子,亲密数 如果整数A的全部因子(包括1 联合开发网 - pudn.com...

该资源包含一个C/C++程序,用于查找3000以内的亲密数。亲密数是指两个整数,它们的因子之和相等。算法通过计算每个数的因子总和来确定亲密数对。程序展示了如何在Linux/Unix环境中使用C语言进行编程。
摘要由CSDN通过智能技术生成

亲密数

所属分类:Linux/Unix编程

开发工具:C/C++

文件大小:1KB

下载次数:10

上传日期:2005-12-05 15:00:03

上 传 者:姚紫欣

说明:  如果整数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.*)

文件列表:[举报垃圾]

近期下载者:

相关文件:

收藏者:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值