Wolfram Research

Function Repository Resource:

ChebyshevTheta

Source Notebook

Calculate the value of the first Chebyshev function θ(x)

Contributed by: Jack Heimrath

ResourceFunction["ChebyshevTheta"][x]

returns the value of the first Chebyshev function at x.

Details and Options

The first Chebyshev function θ(x) is equal to the sum of the logarithms of prime numbers less than or equal to x. For x<2 the sum is empty and by convention we set θ(x)=0.
The Prime Number Theorem is equivalent to the statement that as x.
θ(x)=ψ(x)+O(1), where ψ is the second Chebyshev function.

Examples

Basic Examples

Compute θ(30):

In[1]:=
ResourceFunction["ChebyshevTheta"][30]
Out[1]=

Obtain a decimal approximation:

In[2]:=
ResourceFunction["ChebyshevTheta"][30] // N
Out[2]=

Plot θ(x) from 0 to 30:

In[3]:=
Plot[ResourceFunction["ChebyshevTheta"][x], {x, 0, 30}]
Out[3]=

Compare x, θ(x), and |x-θ(x)|:

In[4]:=
Plot[{x, ResourceFunction["ChebyshevTheta"][x], Abs[x - ResourceFunction["ChebyshevTheta"][x]]}, {x, 0, 30}, PlotLegends -> {"\!\(\*
StyleBox[\"x\", \"TI\"]\)", "\[Theta](\!\(\*
StyleBox[\"x\", \"TI\"]\))", "|\!\(\*
StyleBox[\"x\", \"TI\"]\)-\[Theta](\!\(\*
StyleBox[\"x\", \"TI\"]\))|"}]
Out[4]=

Plot the ratio :

In[5]:=
Plot[ResourceFunction["ChebyshevTheta"][x]/x, {x, 0, 100}]
Out[5]=

Resource History

License Information