#include #include char *P = 0; int Pr(int n) { P = (char*)malloc(sizeof(char)*(n+1)); int i; int j; for (i=0; i<=n; i++) P[i] = 1; P[0] = 0; P[1] = 0; for (i=2; i<=n; i++) { if (P[i] == 1) { for (j=i*2; j<=n; j+=i) { P[j] = 0; } } } } int main() { int N,L; scanf("%d %d",&N,&L); int i; long long int M = 0; if (2 <= L/(N-1)) { M += (L - 2*(N-1) + 1); } Pr(L/(N-1)); for (i=3; i<=L/(N-1); i+=2) { if (P[i] == 1) { M += (L - i*(N-1) + 1); } } printf("%lld\n",M); return 0; }