#define _CRT_SECURE_NO_WARNINGS
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<stack>
#include<iostream>
#include<set>
#include<algorithm>
#include<stdio.h>
using namespace std;
bool isPrime(int num)
{
int range = sqrt(num) + 1;
for (int i = 2; i < range; i++)
if (num%i == 0)
return false;
return true;
}
int main()
{
long num;
cin >> num;
if (num == 1)
{
cout << "1=1";
return 0;
}
int rang = num;
vector<int>vPrime;
int itmp_num=num;
for (int i = 2; i <= rang; i++)
{
if (itmp_num == 1)
break;
if (isPrime(i))
{
while (itmp_num%i == 0)
{
vPrime.push_back(i);
itmp_num /= i;
rang = itmp_num;
}
}
}
int ipri = vPrime[0];
cout << num << "=" << ipri;
int count = 1;
for (int i = 1; i < vPrime.size(); i++)
{
if (vPrime[i] == ipri)
{
count++;
//cout << "^" << ipri;
}
else
{
if (count > 1)
cout << "^" << count;
cout << "*" << vPrime[i];
ipri = vPrime[i];
count = 1;
}
}
if (count > 1)
cout << "^" << count;
return 0;
}
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<stack>
#include<iostream>
#include<set>
#include<algorithm>
#include<stdio.h>
using namespace std;
bool isPrime(int num)
{
int range = sqrt(num) + 1;
for (int i = 2; i < range; i++)
if (num%i == 0)
return false;
return true;
}
int main()
{
long num;
cin >> num;
if (num == 1)
{
cout << "1=1";
return 0;
}
int rang = num;
vector<int>vPrime;
int itmp_num=num;
for (int i = 2; i <= rang; i++)
{
if (itmp_num == 1)
break;
if (isPrime(i))
{
while (itmp_num%i == 0)
{
vPrime.push_back(i);
itmp_num /= i;
rang = itmp_num;
}
}
}
int ipri = vPrime[0];
cout << num << "=" << ipri;
int count = 1;
for (int i = 1; i < vPrime.size(); i++)
{
if (vPrime[i] == ipri)
{
count++;
//cout << "^" << ipri;
}
else
{
if (count > 1)
cout << "^" << count;
cout << "*" << vPrime[i];
ipri = vPrime[i];
count = 1;
}
}
if (count > 1)
cout << "^" << count;
return 0;
}