1 long long euler_phi(int n) 2 { 3 int m=(int)sqrt(n+0.5); 4 int ans=n; 5 for(int i=2;i1)ans=ans/n*(n-1);14 return ans;15 }Descriptio...
分类:
其他好文 时间:
2015-07-19 20:03:03
阅读次数:
137
Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separated into piles in exactly seven
different ways, so p(5)=7.
...
分类:
其他好文 时间:
2015-07-19 16:35:22
阅读次数:
181
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a su...
分类:
其他好文 时间:
2015-07-18 18:41:52
阅读次数:
94
It is possible to write ten as the sum of primes in exactly five different ways:
7 + 3
5 + 5
5 + 3 + 2
3 + 3 + 2 + 2
2 + 2 + 2 + 2 + 2
What is the first value which can be written as the sum o...
分类:
其他好文 时间:
2015-07-18 18:40:05
阅读次数:
118
题意:给一个图,图中有部分是向边,部分是无向边,要求判断是否存在欧拉回路,若存在,输出路径。分析:欧拉回路的定义是,从某个点出发,每条边经过一次之后恰好回到出发点。 无向边同样只能走一次,只是不限制方向而已,那么这个情况下就不能拆边。不妨先按照所给的start和end的顺序,初步定下该无向边的顺序....
分类:
编程语言 时间:
2015-07-18 12:19:48
阅读次数:
428
The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145:
1! + 4! + 5! = 1 + 24 + 120 = 145
Perhaps less well known is 169, in that it produces the...
分类:
其他好文 时间:
2015-07-17 22:49:49
阅读次数:
132
Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d ≤ 8 in ascending or...
分类:
其他好文 时间:
2015-07-17 16:26:05
阅读次数:
130
Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d ≤ 8 in ascending or...
分类:
其他好文 时间:
2015-07-17 16:24:15
阅读次数:
121
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number
of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2,...
分类:
其他好文 时间:
2015-07-17 14:04:42
阅读次数:
142
Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.
Working clockwise, and starting from the group of three with the numerically lowest exte...
分类:
其他好文 时间:
2015-07-17 10:06:11
阅读次数:
231