#include<stdio.h>
#include<iostream>
using namespace std;
int a[8000]={2,3};
int hash[80000]={0};
void func()
{
    int i,j,k=2,flag;
    hash[2]=hash[3]=1;
    for(i=5;k<7100;i+=2)
    {
        flag=1;
        for(j=0;a[j]*a[j]<i;j++)
        {
            if(i%a[j]==0)
            {
                flag=0;
                break;
            }
        }
        if(flag)
        {
            a[k++]=i;
            hash[i]=1;
        }    
    }
}
int main()
{
    func();
    //printf("%d\n",a[6990]);
    int n;
    scanf("%d",&n);
    while(n--)
    {
        int p=0;
        scanf("%d",&p);
        while(hash[p]==0)
        {
            for(int j=0;j<6990&&p>=a[j];j++)
            {
                while(p%a[j]==0&&hash[p]==0)
                {
                    printf("%d*",a[j]);
                    p=p/a[j];
                }
            }
        }
        printf("%d\n",p);
    }
    return 0;
}

 

相关文章:

  • 2021-08-20
  • 2021-12-18
  • 2021-06-30
  • 2021-06-06
  • 2021-09-02
  • 2021-05-31
  • 2022-02-24
  • 2021-12-03
猜你喜欢
  • 2022-01-09
  • 2021-08-04
  • 2022-02-14
  • 2021-11-11
  • 2021-11-07
  • 2022-12-23
  • 2022-02-23
相关资源
相似解决方案