When the addition of the divisors of a number equals the number itself it is said to be perfect.
Divisors of 6 ->1, 2, 3 and 1+2+3=6 ,Divisors of 28->1, 2, 4, 7, 14 and 1+2+4+7+14=28
1st number=6, 2nd number=28.
There are many numbers like these
Find the difference between the 7th and the 6th perfect number.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Check this java program it will give the answer.
public class perfect { public static void main(String args[])
{
long x=0,s=0,a=0,n=0,c,i;
for(i=1;;i++){
if(a<=7)
{
for(long j=1;j<i;j++)
{
if(i%j==0)
x+=j;
}
if(x==i)
a++;
if(a==6)
s=x;
if(a==7)
n=x;
}
else
break;
}
c=n-s;
System.out.println("And the difference is"+c);
}
}