欧拉函数
文章平均质量分 78
UMR小豪
这个作者很懒,什么都没留下…
展开
-
FZU-1759 Super A^B mod C
Given A,B,C, You should quickly calculate the result of A^B mod C. (1InputThere are multiply testcases. Each testcase, there is one line contains three integers A, B and C, separated by a sing原创 2017-08-04 16:11:17 · 521 阅读 · 0 评论 -
HDU-4707 Sum
Input2Output2 Hint 1. For N = 2, S(1) = S(2) = 1.2. The input file consists of multiple test cases. Sample Input2Sample Output2原创 2017-08-04 15:23:17 · 218 阅读 · 0 评论 -
BZOJ3884 上帝与集合的正确用法 (欧拉定理)
根据一些书上的记载,上帝的一次失败的创世经历是这样的:第一天, 上帝创造了一个世界的基本元素,称做“元”。第二天, 上帝创造了一个新的元素,称作“α”。“α”被定义为“元”构成的集合。容易发现,一共有两种不同的“α”。第三天, 上帝又创造了一个新的元素,称作“β”。“β”被定义为“α”构成的集合。容易发现,一共有四种不同的“β”。第四天, 上帝创造了新的元素“γ”,“γ”被原创 2017-08-04 18:34:43 · 347 阅读 · 0 评论 -
poj2407 Relatives
Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a = xy a原创 2017-08-04 20:29:43 · 230 阅读 · 0 评论 -
poj2478 Farey Sequence
The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 F2 = {1/2} F3 = {1/3, 1/2, 2/3} F4 = {1/4, 1/3, 1/2, 2/3, 3/4} F5 = {1/5, 1/4, 1/3, 2/原创 2017-08-04 20:54:29 · 196 阅读 · 0 评论 -
欧拉函数的求法(线性筛)
欧拉函数对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。例如euler(8)=4,因为1,3,5,7均和8互质。 Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的所有素因数,x是不为0的整数。euler(1)=1(唯一和1互质的数就是1本身)。原创 2017-08-04 16:08:12 · 984 阅读 · 0 评论 -
poj1284 Primitive Roots
We say that integer x, 0 i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, the consecutive powers of 3 modulo 7 are 3, 2, 6, 4, 5, 1, and thus 3 is a primitive root modulo 7. Wr原创 2017-08-05 21:12:57 · 259 阅读 · 0 评论