A more algorithmic definition for a perfect number is a number where the sum of the factors (excluding the number itself) equals the number.
更规则的完全数定义是因子(不包括该数字本身)之和等于该数字的数字。
A study of 1,000 women aged 18 to 45 found that just under half (49 per cent) believe that four is the perfect number of best friends to have.
一项对1000名年龄在18岁到45岁之间的女性开展的研究发现,近一半(49%)的女性认为拥有四个好朋友最理想。
I must decompose the problem and think about what "perfect number" means. I can easily come up with several steps required to discover a perfect number.
我必须分解问题并回想“完全数”的含义。
This code reports that my perfect-number algorithm works correctly, but it's very slow.
这段代码报告我的完全数算法工作正常,但是它非常慢。
Let's say that you've written your perfect-number finder TDD, and some other group within your company has written a test-after version of a perfect-number finder (an example appears in Part 1).
假设您已经编写了完全数查找程序的TDD版本,而您公司中的另一个开发组编写了完全数查找程序的后测试版本(第1部分中有一个示例)。
That's the problem domain to tackle: create a perfect-number finder.
这就是要处理的问题域:创建一个完全数查找程序。
In Part 1, I wrote a version of a perfect-number finder using test-after development (writing the test after writing the code).
在第1部分中,我采用后测试开发方法(在编写代码之后编写测试)编写了完全数查找程序的一个版本。
I'm done with the test-driven version of the perfect-number finder; the entire class is shown in Listing 9.
最后,完成了完全数查找程序的测试驱动版本;完整的类见清单9。
You can see this in the number and names of methods in the solution driven by TDD. Here are the methods in the final version of the TDD perfect-number categorizer
在TDD 驱动的解决方案中,方法的数量和名称反映了这种思想。
You can see this in the number and names of methods in the solution driven by TDD. Here are the methods in the final version of the TDD perfect-number categorizer
在TDD 驱动的解决方案中,方法的数量和名称反映了这种思想。
应用推荐