import timedef f(x): #判断 x 是否为素数,返回bool值 if x == 2: return True elif x <= 1: return False else: t = False #判断是否能够整除 for i in range(2, int(x**.5)+1): i ...
分类:
编程语言 时间:
2018-06-02 16:35:37
阅读次数:
213
题目链接: https://projecteuler.net/problem=435 题意: The Fibonacci numbers $ {f_n, n ≥ 0}$ are defined recursively as $f_n = f_{n 1} + f_{n 2}$ with base ca ...
分类:
其他好文 时间:
2018-05-18 23:28:26
阅读次数:
202
project euler 169 题目链接:https://projecteuler.net/problem=169 参考题解:http://tieba.baidu.com/p/2738022069 c++ include using namespace std; define fi first ...
分类:
其他好文 时间:
2018-03-24 11:35:36
阅读次数:
189
这是一道很综合的计数问题,对于思维的全面性,解法的过渡性,代码能力,细节处理,计数问题中的各种算法,像gcd、容斥、类欧几里德算法都有考察.在省选模拟赛中做到了这题,然而数据范围是n,m小于等于1000.首先有一个O(n^4m^4)的暴力.然后开始计数,思路是:答案等于任取4个点的方案数+2*取4个 ...
分类:
其他好文 时间:
2018-03-16 21:34:32
阅读次数:
265
【题目】GCD of Divisors 【题意】给定f(n)=Σd|n gcd(d,n/d)的前缀和F(n),n=10^15。 【算法】莫比乌斯反演 【题解】参考:任之洲数论函数.pdf 这个范围显然杜教筛也是做不了的,而且考虑直接化简f(n)也遇到了困难,所以考虑将前缀和的Σ一起化简。 $$F(n ...
分类:
其他好文 时间:
2018-03-01 17:06:21
阅读次数:
269
题目链接: https://projecteuler.net/problem=501 题意: $f(n)$ be the count of numbers not exceeding $n$ with exactly eight divisors. 就是找少于等于 $n$中只有8个因子的个数。 Yo ...
分类:
其他好文 时间:
2018-02-18 21:30:40
阅读次数:
274
题目链接: https://projecteuler.net/problem=429 题目: A unitary divisor $d$ of a number $n$ is a divisor of $n$ that has the property $gcd(d, n/d) = 1$. The ...
分类:
其他好文 时间:
2018-01-14 11:01:48
阅读次数:
141
在$project euler$ 的第$10$题的 $forum$ 中Lucy Hedgehog 提到的这种方法。 求 $n$ 以内素数个数以及求 $n$ 以内素数和的算法。 定义$S(v,p)$为$2$到$v$所有整数中,在普通筛法中外层循环筛完 $p$ 时仍然幸存的数的和。因此这些数要不本身是素 ...
分类:
其他好文 时间:
2018-01-07 16:04:24
阅读次数:
188
[Perl 6][Project Euler] Problem 9 - Special Pythagorean triplet Description A Pythagorean triplet is a set of three natural numbers, a < b < c, for wh ...
分类:
其他好文 时间:
2017-09-26 01:08:52
阅读次数:
154
题意: 找出满足下列条件的所有$e$ 的和, - $1 < e < \varphi \left( {1009,3643} \right)$ - $gcd(e,φ)=1$ - 满足${m^e} \equiv m{\rm{ }}\bmod {\rm{ }}n$ 的m的个数最小 解答: 这道题最重要的就是 ...
分类:
其他好文 时间:
2017-09-05 01:41:18
阅读次数:
168