F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

GTW likes function

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 646    Accepted Submission(s): 363


Problem Description
Now you are given two definitions as follows.

$f(x)=\sum_{k=0}^{x}(-1)^{k}2^{2x-2k}C_{2x-k+1}^{k},f_{0}(x)=f(x),f_{n}(x)=f(f_{n-1}(x))(n\geq 1)$

Note that $\varphi(n)$ means Euler¡¯s totient function.($\varphi(n)$is an arithmetic function that counts the positive integers less than or equal to n that are relatively prime to n.)

For each test case, GTW has two positive integers ¡ª $n$ and $x$, and he wants to know the value of the function $\varphi(f_{n}(x))$.
 

Input
There is more than one case in the input file. The number of test cases is no more than 100. Process to the end of the file.

Each line of the input file indicates a test case, containing two integers, $n$ and $x$, whose meanings are given above. $(1\leq n,x \leq 10^{12})$
 

Output
In each line of the output file, there should be exactly one number, indicating the value of the function $\varphi(f_{n}(x))$ of the test case respectively.
 

Sample Input
1 1 2 1 3 2
 

Sample Output
2 2 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 13:03:53, Gzip enabled