B - Math

JATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer nn , you can perform the following operations zero or more times:

  • mul xx : multiplies nn by xx (where xx is an arbitrary positive integer).
  • sqrt: replaces nn with n−−√n (to apply this operation, n−−√n must be an integer).

You can perform these operations as many times as you like. What is the minimum value of nn , that can be achieved and what is the minimum number of operations, to achieve that minimum value?

Apparently, no one in the class knows the answer to this problem, maybe you can help them?

Input

The only line of the input contains a single integer nn (1≤n≤1061≤n≤106 ) — the initial number.

Output

Print two integers: the minimum integer nn that can be achieved using the described operations and the minimum number of operations required.

Examples

Input

20

Output

10 2

Input

5184

Output

6 4

Note

In the first example, you can apply the operation mul 55 to get 100100 and then sqrt to get 1010 .

In the second example, you can first apply sqrt to get 7272 , then mul 1818 to get 12961296 and finally two more sqrt and you get 66 .

Note, that even if the initial value of nn is less or equal 106106 , it can still become greater than 106106 after applying one or more operations.

这道题被数论弄懵圈了,他是给你一个数字,然后你有两种操作可以执行,一种是乘以任意数字,另一种是开方,看似模拟就可以,但是还是数论的知识,他在于你你得将他的素因子找出来并且重复的只计算一次,然后另素因子相等,去判断分别增加了多少次幂,然后给幂开方求出操作数。

#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string>
#include<map>
#include<math.h>
#define inf 0x3f3f3f3f
#define mod 1000000007
using namespace std;
int main()
{
    long long n;
    while(~scanf("%lld",&n))
    {
        if(n==1)
            printf("1 0\n");
        else
        {
            long long ans=1,num=0,m=n;
            int i,j;
            for(i=2;;i++)
            {
                if(m==1)
                    break;
                if(m%i==0)
                    ans*=i;
                while(m%i==0)
                {
                    m/=i;
                }
            }
            long long x=ans;
            while(x%n)
            {
                x*=x;
                num++;
            }
            if(x>n)
                num++;
            printf("%lld %lld\n",ans,num);
        }
    }
    return 0;
}
 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值