View Code of Problem 93

#include <stdio.h>
#include <stdlib.h>
// 亲密数
void computer(int n)
{
    int temp=0,tempN=0,i;
    for(i=1;i<=n/2;i++)
    {
        if(n%i==0)
        {
            temp+=i;
        }
    }
 
    for(i=1;i<=temp/2;i++)
    {
        if(temp%i==0)
        {
            tempN+=i;
        }
    }
    if(n==tempN&&n>temp)
    {
        printf("%d %d\n",n,temp);
    }
 
}//computer
int main()
{
    int i;
    for(i=1;i<2000;i++)
    {
        computer(i);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 93