Advertisement
NikolayChukanov

sieve of eratosthenes

Oct 11th, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. struct pii{
  6.   int64_t a, b;
  7. };
  8.  
  9. vector <pii> factorise(int64_t n){
  10.   vector<pii>
  11.   for (int64_t i = 2; i * i <= n; i++){
  12.     if (n % i > 0){
  13.       continue;
  14.     }
  15.     res.push_back({i, 0});
  16.     while (n % i == 0){
  17.       ++res.back().b;
  18.       n /= i;
  19.     }
  20.   }
  21.   if (n > 1){
  22.     res.push_back({n, 1});
  23.   }
  24.   return res;
  25. }
  26.  
  27. int main(){
  28.   ios::sync_with_stdio(false);
  29.   cin.tie(0);
  30.  
  31.   int64_t n;
  32.   cin >> n;
  33.   vector<pii> divs = factorise(n);
  34.   for (pii )
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement