A simple solution would be to define the function \[CapitalPhi][m_, k_] := Cyclotomic[m, k] Then write your comparision as myPi[n_] := Sum[KroneckerDelta[\[CapitalPhi][m, 1], m], {m, 1, n}] myPi[1001] == PrimePi[1001] (* Out[505]= True *) Copying the first line as Latex gives the string \text{myPi}(\text{n$\_$})\text{:=}\sum _{m=1}^n \delta _{\Phi (m,1),m} which shows up as $$\text{myPi}(\text{n$\_$})\text{:=}\sum _{m=1}^n \delta _{\Phi (m,1),m}$$