Find the semi perfect numbers
Hi friends,
I have a question about finding the semi perfect numbers. Semi perfect number: The sum of three biggest divisors of any number apart from the number equals the that number.
For example:
6's divisors : 6, 3, 2, 1 >>> 3 + 2 + 1 = 6 This is semi perfect
30's divisors : 30, 15, 10, 6, 5, 3, 2, 1 >>> 15+10+6 = 31 This isn't semi perfect
36's divisors : 36, 18, 12, 9, 6, 4, 3, 2, 1 >>> 18+12+9 = 39 This isn't semi perfect
18's divisors: 18, 9, 6, 3, 2, 1 >>> 9 + 6 + 3 = 18 This is semi perfect.
I want there is a combobox. In combobox there will be 4 option " 1 2 3 4". When I click "1" it will print the semi perfect numbers in one stage on picturebox. When I click "2" it will print the semi perfect numbers in two stage
on picturebox.
I did lots of tries but it didn't work. At least If you give me the diagram, it will be perfect for me.
Thanks...
Re: Find the semi perfect numbers
I suppose this would be a bit like the factors code that is floating around in the maths section somewhere.
Re: Find the semi perfect numbers
you can try like
vb Code:
Dim divisors() As Long
ReDim divisors(2)
For i = 4 To 1000 Step 2
tot = 0
d = 0
ReDim divisors(2)
For j = i / 2 To 1 Step -1
If i / j = i \ j Then divisors(d) = j: d = d + 1
If d = 3 Then Exit For
Next
If d = 3 Then
For k = 0 To 2
tot = tot + divisors(k)
Next
If tot = i Then snums = snums & "; " & tot
End If
Next
MsgBox Mid(snums, 2)
someone may have a better solution
Re: Find the semi perfect numbers
Firstly, Thanks for reply :) Unfortunatelly, it didn't work. You don't need to copy the codes. If you tell the diagram and how I can do, that's enough for me.
Re: Find the semi perfect numbers
Exactly what do you want with your semi perfect thing?
Do you want to get the largest factors of your numbers and then their sum? If the sum of the 3 biggest divisors exceeds the number itself them they aren't semi perfect, right?
Or is it something else?
EDIT: Also what do you mean by "1 stage" and "2 stage" printing?
Re: Find the semi perfect numbers
Quote:
Unfortunatelly, it didn't work.
what did not work?
you got error?
nothing happen?
wrong result?
Quote:
If you tell the diagram and how I can do
diagram of what?
Re: Find the semi perfect numbers
Quote:
Originally Posted by
westconn1
wrong result?
Well, according to this articles on Wikipedia (which, the below is just one on the subject):
http://en.wikipedia.org/wiki/Semiperfect_number
The number 12 is also one of the numbers.
Re: Find the semi perfect numbers
Quote:
Well, according to this articles on Wikipedia (which, the below is just one on the subject):
i had not read the definition, i was just working with the description as provided by the op,
Quote:
The sum of three biggest divisors of any number
which would not include 12, 6+4+3=13
but as the op did not specify what the problem was, i can not guess