迷失在完美数字计划上 [英] Lost on Perfect Numbers program
问题描述
- 我应该制作一个测试完美数字的程序。如果计算main方法,我必须使用2种方法和3种方法。
- 我的第一种方法必须返回布尔值true或
false如果参数是或不是一个完美的数字。我发现所有完美的数字要么以6或8结尾,所以我想我可以使用类似的东西...
完美数字的定义是什么?从那里开始,忘记
的可分性为六或八。这只是一个必要但不够充足的条件。
亲切的问候,
Jos
well aa number被定义为正整数,它是正确的除数之和。喜欢
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
>
但他们发现所有完美的数字都以8和6结尾,这就是为什么我想出了这个想法
well aa完美数被定义为正整数,它是正确的除数之和。喜欢
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
>
但是他们发现所有完美的数字都以8和6结尾,这就是为什么我想出了这个想法
这就是我写的:它只是一个必要但不充分的条件,即
8一个完美的数字,或16或18或26?你必须找到一个数字的除数
并添加它们才能看出一个数字是否是一个完美的数字。
你知道吗?如何找到一个数字的除数?
亲切的问候,
Jos
-Alright im supposed to make a program that tests for perfect numbers. I have to use 2 methods and 3 methods if you count the main method.
-My first method has to return a boolean value of true or
false if the argument is or isn''t a perfect number. I found that all perfect numbers either end in a 6 or an 8 so i was thinking i could just use something like...
What is the definition of a perfect number? Start from there and forget the
divisability by six or eight. That is just a necessary but not a sufficient
condition.
kind regards,
Jos
well a a perfect number is defined as a positive integer which is the sum of its proper positive divisors. Like
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
but they found all perfect numbers end in 8 and 6 so thats why i came up with that idea
well a a perfect number is defined as a positive integer which is the sum of its proper positive divisors. Like
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
but they found all perfect numbers end in 8 and 6 so thats why i came up with that ideaThat''s what I wrote: it is just a necessary but not a sufficient condition, i.e. is
8 a perfect number, or 16 or 18 or 26? You have to find the divisors of a number
and add them to be able to see whether or not a number is a perfect number.
Do you know how to find the divisors of a number?
kind regards,
Jos
这篇关于迷失在完美数字计划上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!