Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute Ramanujan primes
ResourceFunction["RamanujanPrimes"][n] returns the first n Ramanujan primes. |
Compute the first twenty Ramanujan primes:
In[1]:= | ![]() |
Out[1]= | ![]() |
It takes only around 9 seconds to find the all Ramanujan primes less than 109 on modern computers:
In[2]:= | ![]() |
Out[2]= | ![]() |
The largest Ramanujan prime just under 109:
In[3]:= | ![]() |
Out[3]= | ![]() |
The number of Ramanujan primes less than one billion:
In[4]:= | ![]() |
Out[4]= | ![]() |
Compute the same number using the definition of Ramanujan primes:
In[5]:= | ![]() |
Out[5]= | ![]() |
Recover the sequence of natural numbers from Ramanujan primes:
In[6]:= | ![]() |
Out[6]= | ![]() |
In[7]:= | ![]() |
Out[7]= | ![]() |
For all n>=1, we have the following bounds for the n-th Ramanujan prime:
In[8]:= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
Use "Ramanujan Primes" on Wolfram Demonstrations to visualize the patterns for small Ramanujan primes:
In[10]:= | ![]() |
Out[10]= | ![]() |
The input must be positive integer. Otherwise it returns unevaluated:
In[11]:= | ![]() |
Out[11]= | ![]() |
If pn+2 = pn+1, then pn and pn+1 are twin primes. If Rn+2 = Rn+1, then Rn and Rn+1 are twin Ramanujan primes; the smallest are 149 and 151. Find the number twin Ramanujan primes in the first 100k Ramanujan primes:
In[12]:= | ![]() |
In[13]:= | ![]() |
The distribution of gaps between Ramanujan primes:
In[14]:= | ![]() |
Out[14]= | ![]() |
The number of pairs of twin Ramanujan primes:
In[15]:= | ![]() |
Out[15]= | ![]() |
See the twin Ramanujan primes:
In[16]:= | ![]() |
Out[16]= | ![]() |
Import a definition of Brun's constant. This is an analogous topic:
In[17]:= | ![]() |
Out[17]= | ![]() |
Here only twin Ramanujan primes are applied:
In[18]:= | ![]() |
Out[18]= | ![]() |
The number of twin Ramanujan prime pairs less than 10, 100, 1000,…, 109:
In[19]:= | ![]() |
In[20]:= | ![]() |
Out[20]= | ![]() |
Wolfram Language 14.0 (January 2024) or above
This work is licensed under a Creative Commons Attribution 4.0 International License