#include using namespace std; long long int max(long long int a, long long int b){ if(a>b) return a; return b; } bool isPrime(long long int n) { long long int i; // Corner cases if (n <= 1) return false; if (n <= 3) return true; // This is checked so that we can skip // middle five numbers in below loop if (n%2 == 0 || n%3 == 0) return false; for (i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } long long int caluculateMaxSteps(long n){ if (n < 2) return n; if(isPrime(n)) return n+1; else{ long long int max1 =1,prevmax =1; for (int i = 2; i <= n; ++i) { max1=1; if(isPrime(i) && n%i==0){ max1 = max((max1+(i)*(caluculateMaxSteps(n/i))),prevmax); prevmax = max1; cout<<"i== "<>n; long long int ans =0; while(n--){ long input; cin>>input; //caluculateMaxSteps(input); ans = ans+caluculateMaxSteps1(input); } cout< 1 12 --> 2 6 --> 6 3 --> 12 1 0 -> 0 1 -> 1 2 -> (1+2) 3 -> (1+3) 4 -> (1+2+4) 5 -> (1+5) 6 -> (1+3+6) 7 -> (1+7) 8 -> (1+2+4+8) 9 -> (1+3+9) 1,1,3,4,7,6,10,8,13,13, 24 -> (1+) 12 -> 12 1 + 6 + 12 100 2^2 * 5^2 1 + 100 + 50 + 25 + 1+ 12 + 12 /2 + 12 /4 + 12 */