In number theory, Euler's totient function φ(n) counts the positive integers up to a given integer n that are relatively prime to n. It can be defined more formally as the number of integers k in the range 1≤k≤n for which the greatest common divisor…
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember the value of a, please tell him the number of different possible results. Input The first line contains a positive integ…
This time I need you to calculate the f(n) . (3<=n<=1000000) f(n)= Gcd(3)+Gcd(4)+-+Gcd(i)+-+Gcd(n). Gcd(n)=gcd(C[n][1],C[n][2],--,C[n][n-1]) C[n][k] means the number of way to choose k things from n some things. gcd(a,b) means the greatest common di…
Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number that you cannot pay. Inp…
Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only one integer T, indicates the number of tasks. Then, for the next T lines, each line consists of 6 integers, A , B, C, D, P, n. 1≤T≤200≤A,B,C,D≤1091≤P,…
There are an equation. ∑0≤k1,k2,⋯km≤n∏1⩽j<m(kj+1kj)%1000000007=? We define that (kj+1kj)=kj+1!kj!(kj+1−kj)! . And (kj+1kj)=0 while kj+1<kj. You have to get the answer for each n and m that given to you. For example,if n=1,m=3, When k1=0,k2=0,k3=0,(k…
RXD is a good mathematician. One day he wants to calculate: output the answer module 109+7. p1,p2,p3-pk are different prime numbers Input There are several test cases, please keep reading until EOF. There are exact 10000 cases. For each test case, th…
Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes that:f(x)=5x13+13*x5+ka*x,input a nonegative integer k(k<10000),to find the minimal none…
Describtion First we define: (1) lcm(a,b), the least common multiple of two integers a and b, is the smallest positive integer that is divisible by both a and b. for example, lcm(2,3)=6 and lcm(4,6)=12. (2) gcd(a,b), the greatest common divisor of tw…
Giving the N, can you tell me the answer of F(N)? Input Each test case contains a single integer N(1<=N<=10^9). The input is terminated by a set starting with N = 0. This set should not be processed. Output For each test case, output on a line the v…
I will show you the most popular board game in the Shanghai Ingress Resistance Team. It all started several months ago. We found out the home address of the enlightened agent Icount2three and decided to draw him out. Millions of missiles were detonat…
Problem Description When Teddy was a child , he was always thinking about some simple math problems ,such as "What it's 1 cup of water plus 1 pile of dough .." , "100 yuan buy 100 pig" .etc.. One day Teddy met a old man in his dream ,…
A cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and 125. Given an prime number p. Check that if p is a difference of two cu…
Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first mathematicians to study equations where variables were restricted to integral values. In honor of him, these equations are commonly called diophantine e…
先放知识点: 莫比乌斯反演 卢卡斯定理求组合数 乘法逆元 快速幂取模 GCD of Sequence Alice is playing a game with Bob. Alice shows N integers a 1, a 2, -, a N, and M, K. She says each integers 1 ≤ a i ≤ M. And now Alice wants to ask for each d = 1 to M, how many different sequences b…
Describtion In mathematics, the greatest common divisor (gcd) of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.-Wikiped…
Revenge of GCD Problem Description In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or greatest common measure (gcm), of two or more integers (when at least one of them is…
WhereIsHeroFrom: Zty, what are you doing ? Zty: I want to calculate N!.. WhereIsHeroFrom: So easy! How big N is ? Zty: 1 <=N <=1000000000000000000000000000000000000000000000- WhereIsHeroFrom: Oh! You must be crazy! Are you Fa Shao? Zty: No. I haven'…
The Children's Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends. Now I introduce the game to you. Suppose there are N people played the…
A Central Meridian (ACM) Number N is a positive integer satisfies that given two positive integers A and B, and among A, B and N, we have N | ((A^2)*B+1) Then N | (A^2+B) Now, here is a number x, you need to tell me if it is ACM number or not. Input…
A New Change Problem Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number tha…
Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of S by 29). Take X = 1 for an example. The positive integer divisors of 2004^1 are 1, 2, 3,…
Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc. Specially, LPF(1) = 0. Input Each line will con…
本原串 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1091 Accepted Submission(s): 350 Problem Description 由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串?答案mod2008.例如,100100不是本原…