shunfurh 于 2017.08.28 14:52 提问

Arnold

Do you know Vladimir Arnold? He's a mathematician who demonstrated an image transformation method called arnold transformation, which could shuffle all pixels in an image, and after a serials of this transformation, the image would be transformed to its original form.

The transformation method is quite simple. For a given image with N × N pixels (Width and height are both equal to N), a pixel at location (x, y) will be shuffled to location ((x + y) % N, (x + 2 × y) % N) (0 ≤ x < N, 0 ≤ y < N). In one step of transformation, all N × N pixels will be shuffled to new corresponding location, making the image a chaotic one. You can do the transformation as many times as you can.

The arnold transformation is very interesting. For every image of size N × N, after finite steps of transformation, the image will become exact the same as the original one. The minimum number of steps which make every possible image become the same as origin will be called as period of arnold transformation. For a given N, can you calculate the period?

Input

There will be not more than 200 test cases. For each test case, there will be an integer N in one line. Here N (2 ≤ N ≤ 4000000000) equals to width and height of images.

Output

For each test case, please calculate the period of arnold transformation and output it in one line.

Sample Input

11
29
41
Sample Output

5
7
20

1个回答

caozhy      2017.09.11 23:43

arnold教程中文图片版

arnold for maya 2012-2014
maya渲染器arnold2012-2014，附安装说明
ARNOLD 学习笔记
Arnold1 Gamma Gamma是能量单位 大于1 图像变亮 反之变暗 8.16位图都有GAMMAOpenEXR没有嵌入GAMMA，保持线性所有软件GAMMA值为1 Arnold Render Setting GAMMA Correction 全都为2.2 Arnold纠正GAMMA的方法 Arnold Render Setting Color
arnold水晶材料折射测试

Arnold5上手测试
Arnold推出了第5版，和迎接Houdini16的心情一样，即为新特性兴奋又为好几屏要学的东西感到…… 更加兴奋呢。 完整新特性官方列表：https://support.solidangle.com/display/A5ARP/5.0.0.0 Arnold5里让原来的standard作了古，并且提倡用standard surface来代替。整体感觉standard surface = pri
Arnold图像变换算法
// 08C.cpp : Defines the entry point for the console application. //244910074@qq.com #include "stdafx.h" #include #include int _tmain(int argc, _TCHAR* argv[]
arnold变换源代码
Arnold变换是Arnold遍历理论研究中提出的一种变换，俗称猫脸变换，设想在平面单位正方形内绘制一个猫脸图像，这个猫脸图像将逐渐由清晰变模糊，即是猫脸变换。 Arnold变换是对图像中的像素点坐标做变换，当遍布了图像的所有像素之后，便产生了置乱后的图像。另外，对一个数字图像迭代的使用离散化的Arnold变换，可以重复这个变换过程一直做下去。当迭代到某一步时，如果出现的图像达到我们的要求时，便得到我们所需要的置乱后的图像。Arnold变换具有周期性，当迭代到某一变换周期时，将重新得到原始数字图像，所以解密图像依赖于Arnold变换的周期。