Task: Aliquot sequence classifications

C: #include<stdlib.h>
#include<string.h>
#include<stdio.h>

unsigned long long bruteForceProperDivisorSum(unsigned long long n){
	unsigned long long i,sum = 0;
	
	for(i=1;i<(n+1)/2;i++)
		if(n%i==0 && n!=i)
			sum += i;
		
	return sum;
}

void printSeries(unsigned long long* arr,int size,char* type){
	int i;
	
	printf("\nInteger : %llu, Type : %s, Series : ",arr[0],type);
	
	for(i=0;i<size-1;i++)
		printf("%llu, ",arr[i]);
	printf("%llu",arr[i]);
}

void aliquotClassifier(unsigned long long n){
	unsigned long long arr[16];
	int i,j;
	
	arr[0] = n;
	
	for(i=1;i<16;i++){
		arr[i] = bruteForceProperDivisorSum(arr[i-1]);
		
		if(arr[i]==0||arr[i]==n||(arr[i]==arr[i-1] && arr[i]!=n)){
			printSeries(arr,i+1,(arr[i]==0)?"Terminating":(arr[i]==n && i==1)?"Perfect":(arr[i]==n && i==2)?"Amicable":(arr[i]==arr[i-1] && arr[i]!=n)?"Aspiring":"Sociable");
			return;
		}
		
		for(j=1;j<i;j++){
			if(arr[j]==arr[i]){
				printSeries(arr,i+1,"Cyclic");
				return;
			}
		}
	}
	
	printSeries(arr,i+1,"Non-Terminating");
}

void processFile(char* fileName){
	FILE* fp = fopen(fileName,"r");
	char str[21];
	
	while(fgets(str,21,fp)!=NULL)
		aliquotClassifier(strtoull(str,(char**)NULL,10));
	
	fclose(fp);
}

int main(int argC,char* argV[])
{
    if(argC!=2)
		printf("Usage : %s <positive integer>",argV[0]);
	else{
		if(strchr(argV[1],'.')!=NULL)
			processFile(argV[1]);
		else
			aliquotClassifier(strtoull(argV[1],(char**)NULL,10));
	}
	return 0;
}










Fortran:       MODULE FACTORSTUFF	
Concocted by R.N.McLean, MMXV.
c       INTEGER*4 I4LIMIT
c       PARAMETER (I4LIMIT = 2147483647)
       INTEGER*8 TOOBIG		
       PARAMETER (TOOBIG = 2**47)	
       INTEGER LOTS			
       PARAMETER (LOTS = 10000)	
       INTEGER*8 KNOWNSUM(LOTS)	
       CONTAINS			
        INTEGER*8 FUNCTION SUMF(N)	
         INTEGER*8 N			
         INTEGER*8 F,F2		
         INTEGER*8 S,INC,BOOST		
          IF (N.LE.LOTS) THEN		
            SUMF = KNOWNSUM(N)			
           ELSE			
Could use SUMF in place of S, but some compilers have been confused by such usage.
            S = 1			
            F = 1			
            INC = 1			
            IF (MOD(N,2) .EQ. 1) INC = 2
    1       F = F + INC			
            F2 = F*F				
            IF (F2 .LT. N) THEN			
              IF (MOD(N,F) .EQ. 0) THEN		
                BOOST = F + N/F			
                IF (S .GT. TOOBIG - BOOST) GO TO 666	
                S = S + BOOST			
              END IF				
              GO TO 1				
            END IF			
            IF (F2 .EQ. N) THEN	
              IF (S .GT. TOOBIG - F) GO TO 666	
              S = S + F			
            END IF			
            SUMF = S			
          END IF			
         RETURN			
Cannot calculate the sum, because it exceeds the INTEGER*8 limit.
  666     SUMF = -666		
        END FUNCTION SUMF	
         SUBROUTINE PREPARESUMF	
Convert the Sieve of Eratoshenes to have each slot contain the sum of the proper divisors of its slot number.
Changes to instead count the number of factors, or prime factors, etc. would be simple enough.
         INTEGER*8 F		
          KNOWNSUM(1) = 0		
          KNOWNSUM(2:LOTS) = 1		
          DO F = 2,LOTS/2		
            FORALL(I = F + F:LOTS:F) KNOWNSUM(I) = KNOWNSUM(I) + F	
          END DO			
        END SUBROUTINE PREPARESUMF	
         SUBROUTINE CLASSIFY(N)	
         INTEGER*8 N		
         INTEGER ROPE		
         PARAMETER(ROPE = 16)	
         INTEGER*8 TRAIL(ROPE)	
         INTEGER*8 SF		
         INTEGER I,L		
         CHARACTER*28 THIS	
          L = 1		
          TRAIL(1) = N		
          SF = N		
   10     SF = SUMF(SF)		
          IF (SF .LT. 0) THEN		
            WRITE (THIS,11) L,"overflows
   11       FORMAT ("After ",I0,", ",A)		
            CALL REPORT(ADJUSTR(THIS))		
          ELSE IF (SF .EQ. 0) THEN		
            WRITE (THIS,11) L,"terminates
            CALL REPORT(ADJUSTR(THIS))		
          ELSE IF (ANY(TRAIL(1:L) .EQ. SF)) THEN	
            IF (L .EQ. 1) THEN				
              CALL REPORT("Perfect
            ELSE IF (L .EQ. 2) THEN			
              CALL REPORT("Amicable:")			
            ELSE					
              I = MINLOC(ABS(TRAIL(1:L) - SF),DIM=1)	
              IF (I .EQ. 1) THEN		
                WRITE (THIS,12) L		
   12           FORMAT ("Sociable ",I0,":")	
                CALL REPORT(ADJUSTR(THIS))	
              ELSE IF (I .EQ. L) THEN		
                CALL REPORT("Aspiring:")	
              ELSE				
                WRITE (THIS,13) L - I + 1,SF	
   13           FORMAT ("Cyclic end ",I0,", to ",I0,":")	
                CALL REPORT(ADJUSTR(THIS))	
              END IF				
            END IF			
          ELSE				
            IF (L .GE. ROPE) THEN		
              WRITE (THIS,11) L,"non-terminating?"	
              CALL REPORT(ADJUSTR(THIS))		
             ELSE				
              L = L + 1			
              TRAIL(L) = SF			
              GO TO 10				
            END IF			
          END IF		
         RETURN		
         CONTAINS		
          SUBROUTINE REPORT(WHAT)	
           CHARACTER*(*) WHAT		
            WRITE (6,1) WHAT,TRAIL(1:L)
    1       FORMAT (A28,1X,12(I0:","))	
          END SUBROUTINE REPORT	
        END SUBROUTINE CLASSIFY	
       END MODULE FACTORSTUFF	
       PROGRAM CLASSIFYTHEM	
       USE FACTORSTUFF		
       INTEGER*8 I,N		
       INTEGER*8 THIS(14)	
       DATA THIS/11,12,28,496,220,1184,12496,1264460,790,909,     
     1  562,1064,1488,15355717786080/	
         CALL PREPARESUMF		
         DO I = 1,10			
          CALL CLASSIFY(I)
        END DO
         DO I = 1,SIZE(THIS)		
          CALL CLASSIFY(THIS(I))
        END DO
       END