Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  aasas
Language: C/C++
Code:
#include <stdlib.h>
#include <stdio.h>
#define TOP 100000


int main(void) {
     
     int *divs = (int*) malloc(TOP*sizeof(int)), r=0, i=TOP, j,n,p; 
     while (--i) divs[i]=1;
     
     ++i;
     
     while (++i!=TOP) {
          if (divs[i]==1) {
               for (j=i;j!=TOP;++j) {
                    n = j;
                    p = 1;
                    while (!(n%i)) {
                         ++p;
                         n /= i;
                    }
                    divs[j] *= p;
               }
          }
          if (divs[i-1] == divs[i]) ++r;
     }
     printf("%dn",r);

     return 0;
}

          
          
          
Comments: