Dirichlet Function

Author

Eric W. Weisstein
July 29, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/DirichletFunction.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/DirichletFunction.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Code

d[x_]:=1/Denominator[x]

Dirichlet[n_,a_:1.99]:=Module[{i,j},
  Union[Flatten[Table[{i/j,d[i/j]},{j,n},{i,a j}],1]]
]

DirichletLines[n_,a_:1.99]:=Module[{i,j},Union[Flatten[Table[Line[{{i/j,0},{i/j,d[i/j]}}],{j,n},{i,a j}],1]]
]

Graphics[{Red,DirichletLines[30],PlotRange->All}]