Forgot password?
 Create new account
View 131|Reply 1

一些素数的算法

[Copy link]

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-5-8 19:58:09 |Read mode
AlphaExamples/Prime Numbers看到

prime closest to 169743212304
  1. ResourceFunction["ClosestPrime"][169743212304]
Copy the Code

如何获取这个ClosestPrime的源码?
想知道是什么原理

1000th twin prime
  1. ResourceFunction["TwinPrime"][1000]
Copy the Code

如何获取这个TwinPrime的源码?
想知道是什么原理

20th Mersenne prime
  1. ResourceFunction["MersennePrime"][20]
Copy the Code

如何获取这个MersennePrime的源码?
想知道是什么原理

4th Fermat prime
  1. ResourceFunction["FermatPrime"][4]
Copy the Code

如何获取这个FermatPrime的源码?
想知道是什么原理

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2023-5-8 20:02:17
  1. In[16]:= AbsoluteTiming[ResourceFunction["ClosestPrime"][169743212304]]
  2. Out[16]= {0.0019117,169743212279}
  3. In[17]:= AbsoluteTiming[Prime[PrimePi[169743212304-1]]]
  4. Out[17]= {0.011716,169743212279}
Copy the Code

发现这个ClosestPrime比用列表的方式找素数快10倍呢

手机版Mobile version|Leisure Math Forum

2025-4-20 22:09 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list