summaryrefslogtreecommitdiffstats
path: root/inf/zotks/1/prog.c
blob: f3e38f63b13bf904dfb7ec3991a16a0b3d19d550 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

size_t veriga (size_t n, size_t s) {
	for (size_t i = 2; i <= n; i++) {
		if (n % i != 0)
			return veriga(i, s+1);
	}
	return s;
}

int main (int argc, char ** argv) {
	size_t i;
	char in[128];
	fgets(in, 127, stdin);
	char * p;
	size_t a = strtoll(in, &p, 10);
	size_t b = strtoll(p, NULL, 10);
	size_t sum = 0;
	/* fprintf(stderr, "%lu, %lu\n", a, b); */
	for (size_t x = a; x <= b; x++) {
		sum += veriga(x, 1);
	}
	fprintf(stdout, "%lu\n", sum);
	return 0;
}