+ 2

Hey everyone i make code about #SuperperfectNumber but it doesn't work can anyone of you help me!

30th Aug 2017, 1:49 PM
Beautiful mind
Beautiful mind - avatar
25 Answers
+ 3
yes, for example, depend in which number you want to begin. Obviously it is depend of problem to resolve
31st Aug 2017, 1:11 PM
Daniel
Daniel - avatar
+ 7
In your loop you are checking for a condition n%i and you iterate starting from 0. This is why you get a ZeroDivision error - you can't divide by 0. Try with changing the range start to 2 (no point in checking for %1 as it's always 0).
30th Aug 2017, 3:43 PM
Kuba Siekierzyล„ski
Kuba Siekierzyล„ski - avatar
+ 4
what is the problem? share your code
30th Aug 2017, 2:00 PM
Daniel
Daniel - avatar
+ 4
You said "anymore". You mean it even worked?
31st Aug 2017, 1:41 PM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 3
i=int what is it?
31st Aug 2017, 12:02 PM
Daniel
Daniel - avatar
+ 3
Its not correct. You must to initialize with a value because inmediatily next to it you are using the variable in while condition
31st Aug 2017, 12:23 PM
Daniel
Daniel - avatar
+ 3
@Beautiful mind could you comment each coding line? I think something is wrong yet
31st Aug 2017, 1:24 PM
Daniel
Daniel - avatar
+ 3
I think is wrong yet. You are coding to check if a number is superperfect but you dont use sentences in correct way. If you check any number not always work, not always while finish so it is a huge problem
31st Aug 2017, 1:38 PM
Daniel
Daniel - avatar
+ 3
You must to change i increment
31st Aug 2017, 1:39 PM
Daniel
Daniel - avatar
+ 3
You are welcome ;-)
31st Aug 2017, 4:29 PM
Daniel
Daniel - avatar
30th Aug 2017, 2:03 PM
Beautiful mind
Beautiful mind - avatar
+ 2
Yeah that you very much ๐Ÿ‘๐Ÿ‘
31st Aug 2017, 10:06 AM
Beautiful mind
Beautiful mind - avatar
31st Aug 2017, 10:41 AM
Beautiful mind
Beautiful mind - avatar
+ 2
but it doesn't work.. ๐Ÿ˜•
31st Aug 2017, 10:42 AM
Beautiful mind
Beautiful mind - avatar
+ 2
like i=1?
31st Aug 2017, 1:04 PM
Beautiful mind
Beautiful mind - avatar
31st Aug 2017, 1:18 PM
Beautiful mind
Beautiful mind - avatar
+ 2
upiii now it works thank u very much and now i know what was wrong with it ๐Ÿ˜‡๐Ÿ˜‡
31st Aug 2017, 1:19 PM
Beautiful mind
Beautiful mind - avatar
+ 2
Also, @Beautiful Mind I think you are wrong about what is a superperfect number. Look at this Challenge: superperfect numbers in mathematics, superperfect numbers are numbers matching the following criteria: sum of dividers of n is d and sum of dividers of d is n*2. to make an example, 4 is a superperfect number, as 4's dividers are 1,2,4. 1+2+4= 7, and 7's dividers are 1,7. notice as 1+7=8 (4*2) in short, 4 => 1+2+4= 7 => 1+7 = 8 = 4*2. task: write a code to find all the superperfect numbers from 1 to x (code should provide explanation) in any language you prefer
31st Aug 2017, 1:47 PM
Daniel
Daniel - avatar
+ 2
So you must to do the same 'while' with first result m and next yes, compare but new m with n*2
31st Aug 2017, 1:51 PM
Daniel
Daniel - avatar
31st Aug 2017, 1:58 PM
Daniel
Daniel - avatar