From 772f1f8d154756a768df49545d1cfe2359b9ecce Mon Sep 17 00:00:00 2001 From: "xw_y_am@rmbp" Date: Sat, 30 Sep 2017 11:03:18 +0800 Subject: [PATCH] update --- python/131.md | 4 ++-- python/137.md | 18 +++++++++--------- python/tools/algebra.py | 6 ++++++ python/tools/number_theory.py | 13 +++++-------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/python/131.md b/python/131.md index 76ceb8a..92493f5 100644 --- a/python/131.md +++ b/python/131.md @@ -2,12 +2,12 @@ $$ m^3=n^3+n^2p $$ -let $m=n+k$ , then +设 $m=n+k$ ,则 $$ 3n^2k+3nk^2+k^3=n^2p\\ (p-3k)n^2-3k^2n-k^3=0 $$ -witch $p>3k$ . solving this function, we get +其中有 $p>3k$ 。解此方程,得 $$ n = \frac{3k^2 \pm k\sqrt{4kp-3k^2}}{p-3k} $$ diff --git a/python/137.md b/python/137.md index a576704..2ce624d 100644 --- a/python/137.md +++ b/python/137.md @@ -6,33 +6,33 @@ $$ xA_F(x)= \; x^2F_1+x^3F_2+x^4F_3+\cdots $$ -$(1)+(2)$, and consider that $F_1=F_2$, then we have +(1)+(2),且考虑到 $F_1=F_2$ ,有 $$ (1+x)A_F(x)=xF_2+x^2F_2+x^3F_3+\cdots $$ -so +所以 $$ x(1+x)A_F(x)=A_F(x)-xF_1 $$ -then +即 $$ A_F(x)=\frac{x}{1-x-x^2} $$ -we want that $A_F(x)$ could be a nature number, so let +想要 $A_F(x)$ 是自然数,只需设 $$ \frac{x}{1-x-x^2}=n $$ -then +即 $$ nx^2+(n+1)x-n=0 $$ -solve this, get +解此方程,得 $$ x=\frac{\sqrt{5n^2+2n+1}-(n+1)}{2n} $$ -only $5n^2+2n+1$ is square number that can make x to be a rational. +只有 $5n^2+2n+1$ 是平方数时, $x$ 才可能是有理数。 -let's try to analyse how $n$ increasing when $5n^2+2n+1$ is square number. +尝试分析 $N=5n^2+2n+1$ 是平方数时, $n$ 的变化规律 | n | increasing rate of n | | ---------- | -------------------- | @@ -49,4 +49,4 @@ let's try to analyse how $n$ increasing when $5n^2+2n+1$ is square number. | 507544127 | 6.854101982 | | 3478759200 | 6.854101969 | -it is obvious that the rate of $n$ is converge to $6.8541\cdots$ . with using search engein we know $\varphi^4=6.8541\cdots$ and $\varphi=\frac{\sqrt{5}-1}{2}$. \ No newline at end of file +显然 $n$ 的变化率收敛于 $6.8541\cdots$ 。通过搜索引擎可知 $\varphi^4=6.8541\cdots$ 其中 $\varphi=\frac{\sqrt{5}-1}{2}$ 。 \ No newline at end of file diff --git a/python/tools/algebra.py b/python/tools/algebra.py index c2cc446..3c4a91d 100644 --- a/python/tools/algebra.py +++ b/python/tools/algebra.py @@ -4,3 +4,9 @@ def factorial(n, multi=1): return multi else: return factorial(n - 1, multi * n) + +def is_root(n, exp=2): + root = int(n ** (1 / exp)) + if root ** exp == n: + return root + return 0 diff --git a/python/tools/number_theory.py b/python/tools/number_theory.py index 18b7acf..b8d20e8 100644 --- a/python/tools/number_theory.py +++ b/python/tools/number_theory.py @@ -20,12 +20,11 @@ def pow_mod(base, exp, mod): def make_prime(limit): - if limit < 5: - if limit < 2: return - yield 2 - if limit < 3: return - yield 3 - return + if limit < 2: return + yield 2 + if limit < 3: return + yield 3 + if limit < 5: return n = (limit + 1) // 6 @@ -46,8 +45,6 @@ def make_prime(limit): a[f::p] = [False] * ((n - f - 1) // p + 1) b[g::p] = [False] * ((n - g - 1) // p + 1) - yield 2 - yield 3 for i in range(n): if b[i]: yield 6 * i + 5