Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- printf("Hello world\n");
- unsigned long long int j,k,i, n=0;
- unsigned long long int sito[100001];
- unsigned long long int cisla[1299710];
- for (i = 0; i < 1299710; i++)
- {
- cisla[i]=1;
- } // ak cisla[i] == 1 tak je to prvocislo
- cisla[0]=0;
- cisla[1]=0;
- /*cisla[2]=1; 2*1 2*2 2*3 2*4 ...
- cisla[3]=1; 3*1 3*2 <- 3*3 i*j , j=1
- cisla[4]=0;
- */
- //while (scanf("%llu\n", &k)>0)
- scanf("%llu\n", &k);
- for (i = 2; i <= sqrt(1299709); i++)
- {
- if (cisla[i] == 1)
- {
- for (j = i; j*i < 1299710; j++)
- cisla[i*j] = 0;
- }
- }
- //printf("%lu", k);
- for (i = 2; i <= 1299709; i++)
- {
- if (cisla[i] == 1)
- {
- sito[n] = i;
- n++;
- }
- }
- printf("%llu\n", sito[k-1]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement