definite integral in regards to x for n mod x where n is a constant I have read some posts on x mod y integrals but am unsure of how to find the integral of a constant mod x.
For example
6 mod x between 0 and 6
or
10 mod x between 0 and 10.
When I look at the graph of these functions I can see it generates a lot of lines starting at a point on the line y = x and descending to zero at some angle.  So I can tell it generates an infinite number of right triangles between 0 and 1 and then n right triangles between 1 and n.
But I am struggling to even know where to begin to find their area.
 A: You can rewrite the integral as
$$\int_0^x \left(n-t\lfloor\frac nt\rfloor\right)dt.$$
The floor factor remains constant in the ranges $t\in\left(\dfrac n{k+1},\dfrac nk\right]$ for $k$ decreasing from $\infty$ to $m=\lfloor\dfrac nx\rfloor$. The last interval is incomplete, $t\in\left(\dfrac n{m+1},x\right]$.
We have
$$I=\sum_{k=\infty}^{m}\int_{n/(k+1)}^{n/k}\left(n-tk\right)dt+\int_{n/(m+1)}^{x}\left(n-tm\right)dt,$$
giving
$$2I=\sum_{k=\infty}^{m}\left.\left(n-tk\right)^2\right|_{n/(k+1)}^{n/k}+\left.\left(n-tm\right)^2\right|_{n/(m+1)}^{x}\\
=\sum_{k=\infty}^{m}\frac{n^2}{(k+1)^2}+(n-mx)^2-\frac{n^2}{(m+1)^2}\\
=\frac{\pi^2}6-H_m^{(2)}+(n-mx)^2-\frac{n^2}{(m+1)^2},$$
where $H_m^{(2)}$ denotes the generalized harmonic numbers of degree $2$.
A: http://m.wolframalpha.com/input/?i=x%3D10+%28mod+y%29&x=0&y=0
See the graph here, the equation $x\equiv 10$ (mod $y$) has infinite number of lines between $[0,1]$. The roots $x\equiv 0\equiv 10$ (mod $y$) can be found at all $\frac{p}{q}$ where $p$ is a factor of 10 and $q\in\Bbb{N}$. For examples, $\frac{10}{11}$, $\frac{5}{19}$. So it could be hard to find out the value.
But for $y\in[1,10]$, we know the roots of $x\equiv0$ (mod $y$) are located at $1$, $\frac{10}{9}$, $\frac{10}{8}$, $\frac{10}{7}$, $\frac{10}{6}$, $\frac{10}{5}=2$, $\frac{10}{4}$, $\frac{10}{3}$, $\frac{10}{2}=5$ and $10$.
So we can compute the integral by computing the sum of area of triangles. (At least between $[0,1]$), 
$\int_1^{10}{x(y)dy}=\sum_{k=1}^{9} [\frac{1}{2}x(y_k)*(y_{k+1}-y_k)]$
where $y_k$ is the $k^{th}$ root starting from $y_1=1$. 
And $x(y_k)$ is taken to be equal to $\lim_{y \to y_k^-}x(y_k)=y_k$ 
(I take this value because otherwise $x(y_k)$ is counted as $0$)
By computing the sum, you can find that the integral is equal to approximately $17.5116...$, exactly $\frac{2224115}{127008}$.
On the graph, notice that $y=x$ is an asymptote for the function. So when the value of $y$ is small. (Maybe between $[0,1]$). You can approximate the integral by observing the triangles take up about half of the area. So $\int_0^{y_0}x(y)dy\approx \frac{1}{4}y_0^2$ for small $y_0$.
