Forgot password?
 Register account
View 298|Reply 12

[数论] Prime Formulas

[Copy link]

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2023-3-18 21:39 |Read mode
Last edited by hbghlyj 2023-3-20 09:58Honsberger 1976 Mathematical Gems II,第 33 页
$$f(x, y)=\frac{y-1}{2}\left[\left|B^{2}-1\right|-\left(B^{2}-1\right)\right]+2$$其中$B=x(y+1)-(y !+1)$, 当 $x,y$ 为正整数, $f(x,y)$为素数, 且取遍每个奇素数, 每个奇素数仅取一次.
Proof. For all natural $x$ and $y$, the value of $B$ is an integer. Thus $B^2$ is a nonnegative integer. Accordingly, there are the two cases: (a) $B^2 \geqslant 1$, and (b) $B^2=0$.
(a) $B^2 \geqslant 1$ : If $B^2 \geqslant 1$, then $B^2-1 \geqslant 0$, implying that $\left|B^2-1\right|$ $=B^2-1$. This makes $f(x, y)=2$, a prime.
(b) $B^2=0$ : For $B^2=0$ the value of the function is
$$
\begin{aligned}
f(x, y) & =\frac{y-1}{2}[|-1|-(-1)]+2 \\
& =\frac{y-1}{2}[1+1]+2=y-1+2=y+1 .
\end{aligned}
$$
In this case, however, $B$ itself must also be 0 , implying that the numbers substituted for $x$ and $y$ make
$$
x(y+1)-(y !+1)=0, \text { or } x(y+1)=y !+1 .
$$
Accordingly, the number $y+1$ divides $y !+1$. By Wilson's theorem, then, the number $y+1$ is a prime. Consequently, $f(x, y)$ yields prime numbers exclusively.

We note that $f(1,1)=2$. Let $p$ denote an odd prime number. Then, using
$$
y=p-1 \text { and } x=\frac{1}{p}[(p-1) !+1]
$$
($x$ is guaranteed to be a natural number by Wilson's theorem), we see that $f(x, y)$ yields the prime $p$ : from the definitions of $x$ and $y$,
we have
$$
x p=(p-1) !+1 \text { and } p=y+1
$$
then $x p=x(y+1)=(p-1) !+1=y !+1$, making $B=0$ and $f(x, y)=y+1=p$. Thus $f$ yields every prime number.

Since $f$ yields only the values 2 and $y+1$, an odd prime $p$ can arise only as $y+1$. Thus in every pair $(x, y)$ which makes $f(x, y)$ yield the odd prime $p$, we must have $y=p-1$. However, $f$ will yield the odd number $y+1$, rather than 2 , only when $B=0$. Thus the pair $(x, y)$ must also make $x(y+1)=y !+1$. This means that $x$ must have the value $(y !+1) /(y+1)$. The single choice for $y$, then, leads to a single value for $x$, yielding the unique pair
$$
(x, y) \equiv\left(\frac{(p-1) !+1}{p}, p-1\right)
$$
($x$ is natural by Wilson's theorem).
which makes $f$ take the value $p$. Thus, while $f$ produces the number 2 "most of the time," it yields each odd prime exactly once.

Related threads

126

Threads

430

Posts

3152

Credits

Credits
3152

Show all posts

TSC999 Posted 2023-3-19 09:38
Last edited by TSC999 2023-3-19 10:08吴振奎介绍的这个外国人的公式,20 多年前验证过是不对的,那时这书是第一版。现在这书至少又再版了一次吧,仍然没有纠正错误。看来作者也从来没有验证过。读者发现的书中的错误,也没办法告知他改正。

下面这个公式:

当 \(n=1,2,3,\cdots\) 时,\(f(n)=2+(n-1)\lfloor(cos (\frac{n!+1}{n+1}π) )^2\rfloor)\)  给出全部质数。但是这公式有个缺点,就是数列中有许多是重复的质数 2。
可以写个程序从数列中去掉多余的 2:
  1. Do[y = 2 + (n - 1) Floor[Cos[(n! + 1)/(n + 1) \[Pi]]^2];
  2. If[n == 1 && y == 2 || n > 1 && y > 2,
  3.   Print["n = ", n, ",   y = ", y]], {n, 1, 1000}]
Copy the Code

126

Threads

430

Posts

3152

Credits

Credits
3152

Show all posts

TSC999 Posted 2023-3-19 09:44
无论是吴振奎介绍的公式还是 2# 楼的公式,都没有什么大的用处,这是因为使用威尔逊定理来判断是不是质数,不是一个好的方法,不实用。

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

 Author| hbghlyj Posted 2023-3-19 09:58
TSC999 发表于 2023-3-19 02:38
吴振奎介绍的这个外国人的公式,以前验证过好像不对。
怎么验证啊

Comment

给 x, y  赋予许多不同的值,结果 f(x,y) 恒等于 2。  Posted 2023-3-19 10:10
不知道把原公式的哪里抄错了,也许是有笔误之处。  Posted 2023-3-19 10:12

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

 Author| hbghlyj Posted 2023-3-19 10:08
MAA Review of Mathematical Gems I, Ross Honsberger
The author shows us a function of two non-negative integer variables whose range is the primes, with each odd prime appearing precisely once. (The function is Wilson’s Theorem in disguise, but what a clever disguise!)

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

 Author| hbghlyj Posted 2023-3-19 10:19
这个公式为MathWorld的词条Prime Formulas式(17)
This will always have $B(x,y)^2>1$ and hence yield the value 2 unless $x=[(p-1)!+1]/p$ and $y=p-1$, in which case it simplifies to
\[f\left(\frac{(p-1)!+1}p,p-1\right)=p \tag{19}\]
The formula therefore generates odd primes exactly once each (Honsberger 1976, p. 33) at the values for which the Wilson quotient $x=[(p-1)!+1]/p$ is an integer, i.e., 1, 1, 5, 103, 329891, 36846277, 1230752346353, ... (OEIS A007619).
仅当 $x=[(p-1)!+1]/p$ 且 $y=p-1$ 时不会产生值2,在这种情况下它简化为
\[f\left(\frac{(p-1)!+1}p,p-1\right)=p \tag{19}\]
因此,该公式在每个 Wilson 商 $x=[(p-1)!+1]/p$ 的值 1, 1, 5, 103, 329891, 36846277, 1230752346353, ... (OEIS A007619)处生成一次奇素数

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

 Author| hbghlyj Posted 2023-3-19 10:23
TSC999 发表于 2023-3-19 03:10
给 x, y 赋予许多不同的值,结果 f(x,y) 恒等于 2。
1#没有错吧。

126

Threads

430

Posts

3152

Credits

Credits
3152

Show all posts

TSC999 Posted 2023-3-19 10:25
要是这样子的话,那真不如下面这公式:
产生全部质数.png
当 n = 4,6,8,9,10,12,14,15,16,18,......上面公式都给出 2。

126

Threads

430

Posts

3152

Credits

Credits
3152

Show all posts

TSC999 Posted 2023-3-19 15:09
Last edited by TSC999 2023-3-19 16:44
hbghlyj 发表于 2023-3-19 10:30
Honsberger 1976 Mathematical Gems II,第 33 页
$$f(x, y)=\frac{y-1}{2}\left[\left|B^{2}-1\right|-\le ...
要生一个质数 p=13,必须取 y = 12,x = 36846277。
要生另一个质数  p=61,必须取 y = 60,
x =136409624799039182693054773495464989848429059120676163154906191744419672131147541。
这也太难产了吧。老外这个公式真的是不咋的。既不简明,也不优美。

看看还是民科的一个中国人发明的 8# 楼的公式,比老外的公式不知强了多少倍。

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

 Author| hbghlyj Posted 2023-3-19 19:08
TSC999 发表于 2023-3-19 02:38
\(f(n)=2+(n-1)\lfloor(cos (\frac{n!+1}{n+1}π) )^2\rfloor)\)  给出全部质数。
是不是多打一个右括号

126

Threads

430

Posts

3152

Credits

Credits
3152

Show all posts

TSC999 Posted 2023-3-20 09:46
hbghlyj 发表于 2023-3-19 19:08
是不是多打一个右括号
  1. Do[y = 2 + (n - 1) Floor[Cos[(n! + 1)/(n + 1) \[Pi]]^2];  (*中国人发明的公式*)
  2. If[n == 1 && y == 2 || n > 1 && y > 2, Print["n = ", n, ",   y = ", y]], {n, 1, 50}]
Copy the Code

Mobile version|Discuz Math Forum

2025-5-31 11:19 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit