fork(6) download
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. long long prime(long long n)
  6. { bool a[n/2];
  7. for(int i = 0;i<n/2;i++)
  8. a[i] = 1;
  9. for(long long s = 2;s<=int(sqrt(n));s++)
  10. { if(a[s-1] == 0)
  11. continue;
  12. for(long long j = s*s;j<=n/2;j+=s)
  13. { a[j-1] = 0;
  14. /* if(n == j)
  15.   return s;*/
  16. }
  17. }
  18. for(long long i = 1;i<n/2;i++ )
  19. {
  20. if(a[i]==0)
  21. continue;
  22. if(n%(i+1) == 0)
  23. return i+1;
  24. }
  25.  
  26. return n;
  27. }
  28.  
  29. int main()
  30. {
  31. long long n;
  32. cin>>n;
  33. long long a[n];
  34. for(long long j=0;j<=n;j++)
  35. a[j]=0;
  36. for(long long i=2;i<=n;i++)
  37. { long long p = i;
  38. long long k = prime(p);//Returns first prime factor of i
  39. a[k]++;
  40. p = p/k;
  41. while(p!=1)
  42. {
  43. int s = prime(p);
  44. a[s]++;
  45. p = p/s;
  46. }
  47. }
  48.  
  49. long long s=1;
  50. for(long long i = 0;i<=n;i++)
  51. {
  52. if(a[i]==0)
  53. {
  54. continue;
  55. }
  56. // s*=(1+2*a[i]);
  57. s = (s *(1+2*a[i]))%1000007;
  58.  
  59. //cout<<i<<" "<<a[i]<<endl;
  60. }
  61. cout<<s%1000007<<endl;
  62. return 0;
  63. }
  64.  
  65.  
Runtime error #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Standard output is empty