Forgot password
 Register account
View 156|Reply 1

一些素数的算法

[Copy link]

3211

Threads

7832

Posts

52

Reputation

Show all posts

hbghlyj posted 2023-5-8 19:58 |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的源码?
想知道是什么原理

3211

Threads

7832

Posts

52

Reputation

Show all posts

original poster hbghlyj posted 2023-5-8 20:02
  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倍呢

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-20 05:47 GMT+8

Powered by Discuz!

Processed in 0.011801 seconds, 22 queries