![](https://img-blog.csdnimg.cn/20190918140213434.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
数论-欧拉函数
数论
Stephencurry‘s csdn
这个作者很懒,什么都没留下…
展开
-
Relatives (POJ-2407)(欧拉函数)
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...原创 2020-04-15 17:56:40 · 148 阅读 · 0 评论 -
GCD (HDU-1695)(欧拉函数+容斥原理)
Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you're...原创 2020-04-15 17:44:41 · 286 阅读 · 0 评论 -
欧拉函数模板
一、单独求一个数的欧拉函数:例如求1~n中与n互质的数的个数模板一:ll eular(ll n){ ll ans=n; for(ll i=2; i*i<=n; i++) { if(n%i==0) { ans=ans/i*(i-1);//先进行除法防止溢出(ans=ans*(1-1/p(i))) ...原创 2020-04-15 11:34:33 · 207 阅读 · 0 评论 -
浅谈欧拉函数
前言欧拉函数听起来很高大上,但其实非常简单,也是NOIP里的一个基础知识,希望大家看完我的博客能有所理解。数论是数学的一个分支,它只讨论正整数的性质,所以以下都是针对正整数进行研究的。什么是欧拉函数欧拉函数是小于x的整数中与x互质的数的个数,一般用φ(x)表示。特殊的,φ(1)=1。如何计算欧拉函数积性函数欧拉函数的几个性质欧拉函数性质的粗略...转载 2020-04-15 11:19:36 · 242 阅读 · 0 评论 -
找新朋友 (HDU-1286)(欧拉函数)
新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1<CN<10000),接着有CN行正整数N(1<n<3276...原创 2020-04-14 18:07:32 · 309 阅读 · 0 评论