#include <iostream>
int main() {
int n;
std::cout << "Nhap vao so nguyen n: ";
std::cin >> n;
long long T = 0;
int D = 0;
for (int i = 2; i <= n; i++) {
bool isPrime = true;
for (int j = 2; j * j <= i; j++) {
if (i % j == 0) {
isPrime = false;
break;
}
}
if (isPrime) {
T += i;
D++;
}
}
std::cout << "Tong cac so nguyen to tu 1 den " << n << " la: " << T << std::endl;
std::cout << "So luong so nguyen to tu 1 den " << n << " la: " << D << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSB7CiAgICBpbnQgbjsKICAgIHN0ZDo6Y291dCA8PCAiTmhhcCB2YW8gc28gbmd1eWVuIG46ICI7CiAgICBzdGQ6OmNpbiA+PiBuOwogICAgbG9uZyBsb25nIFQgPSAwOwogICAgaW50IEQgPSAwOwogICAgZm9yIChpbnQgaSA9IDI7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgYm9vbCBpc1ByaW1lID0gdHJ1ZTsKICAgICAgICBmb3IgKGludCBqID0gMjsgaiAqIGogPD0gaTsgaisrKSB7CiAgICAgICAgICAgIGlmIChpICUgaiA9PSAwKSB7CiAgICAgICAgICAgICAgICBpc1ByaW1lID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoaXNQcmltZSkgewogICAgICAgICAgICBUICs9IGk7CiAgICAgICAgICAgIEQrKzsKICAgICAgICB9CiAgICB9CiAgICBzdGQ6OmNvdXQgPDwgIlRvbmcgY2FjIHNvIG5ndXllbiB0byB0dSAxIGRlbiAiIDw8IG4gPDwgIiBsYTogIiA8PCBUIDw8IHN0ZDo6ZW5kbDsKICAgIHN0ZDo6Y291dCA8PCAiU28gbHVvbmcgc28gbmd1eWVuIHRvIHR1IDEgZGVuICIgPDwgbiA8PCAiIGxhOiAiIDw8IEQgPDwgc3RkOjplbmRsOwogICAgcmV0dXJuIDA7Cn0=