前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >A Tile Painting(循环节)

A Tile Painting(循环节)

作者头像
风骨散人Chiam
发布2020-10-28 11:45:55
5060
发布2020-10-28 11:45:55
举报
文章被收录于专栏:CSDN旧文

Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.

The path consists of nn consecutive tiles, numbered from 11 to nn. Ujan will paint each tile in some color. He will consider the path aesthetic if for any two different tiles with numbers ii and jj, such that |j−i||j−i| is a divisor of nn greater than 11, they have the same color. Formally, the colors of two tiles with numbers ii and jj should be the same if |i−j|>1|i−j|>1 and nmod|i−j|=0nmod|i−j|=0 (where xmodyxmody is the remainder when dividing xx by yy).

Ujan wants to brighten up space. What is the maximum number of different colors that Ujan can use, so that the path is aesthetic?

Input

The first line of input contains a single integer nn (1≤n≤10121≤n≤1012), the length of the path.

Output

Output a single integer, the maximum possible number of colors that the path can be painted in.

Examples

Input

代码语言:javascript
复制
4

Output

代码语言:javascript
复制
2

Input

代码语言:javascript
复制
5

Output

代码语言:javascript
复制
5

Note

In the first sample, two colors is the maximum number. Tiles 11 and 33 should have the same color since 4mod|3−1|=04mod|3−1|=0. Also, tiles 22 and 44 should have the same color since 4mod|4−2|=04mod|4−2|=0.

In the second sample, all five colors can be used.

代码语言:javascript
复制
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  n,ans;
    bool flag=1;
    scanf("%lld",&n);
    ans=n;
    for(long long i=2;i<=sqrt(n);++i)
    {
        if(n%i==0)
        {
                ans=__gcd(ans,i);
                ans=__gcd(ans,n/i);
        }
    }
    printf("%lld\n",ans);
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/11/19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档