Cod sursa(job #590848)

Utilizator LP337Lazar Pavel LP337 Data 20 mai 2011 16:38:36
Problema Fractii Scor 0
Compilator c Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <stdio.h>

int numbers_bigger_not_multiple( int number, int limit ){
	int numbers = 0,i;
	for( i = number + 1; i <= limit; i++ ){
		if( i % number != 0 )
			numbers++;
	}
	return numbers;
}

int main(){
	FILE *fi = fopen("fractii.in","r");
	FILE *fo = fopen("fractii.out","w");
	int i,sum = 0, N;

	fscanf(fi,"%d",&N);	
	
	sum = 2 * N - 1;
 
	for( i = 2; i <= N; i++ ){
		sum = sum + 2 * numbers_bigger_not_multiple( i, N );
	}
			
	printf("%d\n",sum);
	return 0;
}