number theory – Find roots of a specific discontinuous trigonometric function

Given the following function $f(x)$ and an arbitrary positive non-prime integer $N$

$ { f(x) = sin(Npi/x) + cos(2Npi/x) + |sin(3Npi/x)| + |cos(5Npi/x)| + 1, N in mathbb{Z}, x in mathbb{R} } $

I am looking for any root in the range $2 <= x < N$, I am pretty sure all $f(x)$ are greater than or equal to zero, so the roots are global minima. All the roots are also points of discontinuity and their $x in mathbb{Z} $.


Is there any, even numerical way, to go about finding these roots?

Here is a plot of $f(x)$ for $N=517$. It isn’t very good, its hard to choose a zoom level which will demonstrate all the features. But you can see I marked a zero at $x=22$, you will notice it looks like there is a zero at $x approx 26.5$ but it is actually $ f(x) approx 0.0011 $ if one were to zoom in.

There are many of these “close” to zero points, but none are actually zero, in the range I’m interested in ($ 2<=x<N $), unless 2 conditions I have found are met:

  1. $x in mathbb{Z} $
  2. $GCD(x,N) > 1 $

My example $N=517$ the roots are $ x in {-2,22,94} $, we don’t care about $-2$ and $GCD(22,517)=11$ and $GCD(94,517) = 47$.

I don’t think the GCD observation will help in finding the roots, but I mention it because I think its interesting.

Plot of function for N = 517