[ad_1]
#embrace <bits/stdc++.h>
utilizing
namespace
std;
void
SieveOfEratosthenes(
int
n,
vector<
int
>& v,
int
ok)
{
bool
prime[n + 1];
memset
(prime,
true
,
sizeof
(prime));
for
(
int
i = 2; i * i <= n; i++) {
if
(prime[i]) {
for
(
int
j = i * i; j <= n;
j += i)
prime[j] =
false
;
}
}
for
(
int
i = 2; i < n; i++) {
if
(prime[i]) {
v.push_back(i);
}
if
(v.dimension() == ok) {
break
;
}
}
}
int
total_count(
int
L,
int
R,
int
ok)
{
vector<
int
> v;
SieveOfEratosthenes(100000, v, ok);
int
arr[R + 1] = { 0 };
for
(
int
i = 0; i < v.dimension(); i++) {
int
val;
if
(L % v[i] == 0) {
val = L;
}
else
{
val = ((L / v[i]) + 1) * v[i];
}
for
(
int
j = val; j <= R; j = j
+ v[i]) {
arr[j] = 1;
}
}
int
rely = 0;
for
(
int
i = L; i <= R; i++) {
if
(arr[i] == 0) {
rely++;
}
}
return
rely;
}
int
fundamental()
{
int
L = 10, R = 25;
int
Ok = 3;
cout << total_count(L, R, Ok);
return
0;
}
[ad_2]