#include "bits/stdc++.h" using namespace std; #define MAXN 1000002 // stores smallest prime factor for every number int spf[MAXN]; long long int lpf[MAXN]; long long int res_val[MAXN]; // Calculating SPF (Smallest Prime Factor) for every // number till MAXN. // Time Complexity : O(nloglogn) void sieve() { spf[1] = 1; for (int i=2; i getFactorization(int x) { vector ret; while (x != 1) { ret.push_back(spf[x]); x = x / spf[x]; } return ret; } // A function to print all prime factors of a given number n long long int pf(long long int n) { long long int max_pf= 0 ; // Print the number of 2s that divide n while (n%2 == 0) { // printf("%d ", 2); n = n/2; max_pf= max(max_pf, 2ll ); } // n must be odd at this point. So we can skip // one element (Note i = i +2) for (long long int i = 3; i*i <= n; i = i+2) { // While i divides n, print i and divide n while (n%i == 0) { // printf("%d ", i); n = n/i; max_pf= max(max_pf,i); } } // This condition is to handle the case when n // is a prime number greater than 2 if (n > 2) { // printf ("%d ", n); max_pf= max(max_pf,n); } return max_pf; } long long int fr(long long int x){ if(x==1) return 1; long long int lpf_t; if(x> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for(int i=2;i res=getFactorization(i); lpf[i]= res.back(); // long long int t= Largest_primeFactor(i); // if(lpf[i] != t){ // cout << i << "not " << lpf[i] << " " << t << endl; // } // cout << i << " " << lpf[i] << endl; } for(int i=2;i