官术网_书友最值得收藏!

  • The Modern C# Challenge
  • Rod Stephens
  • 110字
  • 2021-08-13 15:23:54

17. Amicable numbers

Two numbers are amicable numbers if they are different and the sum of each number's proper divisors equals the other number. For example, the divisors of 220 are {1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110} and 1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284. Also, the divisors of 284 are {1, 2, 4, 71, 142} and 1 + 2 + 4 + 71 + 142 = 220. That means 220 and 284 are amicable numbers.

Write a program that finds amicable numbers between 1 and a specified maximum.

主站蜘蛛池模板: 红原县| 尼木县| 越西县| 昆明市| 武平县| 阿荣旗| 霸州市| 甘德县| 枞阳县| 揭阳市| 九台市| 会同县| 岳普湖县| 朔州市| 九龙城区| 湘西| 三原县| 曲靖市| 南陵县| 托克托县| 乌拉特后旗| 青河县| 巴里| 铜山县| 永春县| 乐安县| 南靖县| 永新县| 乃东县| 达尔| 博客| 关岭| 华亭县| 松潘县| 邵武市| 澎湖县| 林芝县| 申扎县| 乌拉特后旗| 大兴区| 银川市|