Integral $\int_0^1 \frac{x^n}{x^2-x+1} dx$ Greetings I desire to find a closed form for $$I=\int_0^1 \frac{x^n}{x^2-x+1} dx$$  My try was to use $x-\frac{1}{2}=t$ to get $$\int_{-\frac{1}{2}}^{\frac{1}{2}}\frac{(t+\frac{1}{2})^n}{t^2+\frac{3}{4}}dt$$ then $\frac{\sqrt 3}{2}\tan u=t$ $$I=\frac{2}{\sqrt 3}\int_{-\frac{\pi}{3}}^{\frac{\pi}{3}}\left(\frac{\sqrt3}{2}\tan u+\frac{1}{2}\right)^ndu$$ I dont know how to takle this down. I am thinking that this can be evaluated using Contour integration because I saw other similarly integrals evaluated that way, but I dont have so much knowdeledge about it. Could you  help me find a closed form for this integral?
 A: I've come up with a better solution than before.
$$I_n=\int_0^1\frac{x^n}{x^2-x+1}dx=\int_0^1x^{n-2}dx+I_{n-1}-I_{n-2}$$
So
$$I_n-I_{n-1}+I_{n-2}=\frac{1}{n-1}$$
By standard methods of difference equations, for the homogeneous part we find that $a^2-a+1=0$ and so $a_1=\frac{1+i\sqrt3}{2},\,a_2=\frac{1-i\sqrt3}{2}$. The Wronskian for the particular solution is thus $W(n)=(a_1a_2)^n(a_1-a_2)$, and so we have that the particular solution coeffecients are
$$u_1(n)=-\sum_{k=0}^{n-1}\frac{a_2}{(k+1)(a_1-a_2)a_1^{k+1}}$$
$$u_2(n)=\sum_{k=0}^{n-1}\frac{a_1}{(k+1)(a_1-a_2)a_2^{k+1}}$$
Thus, the solution is
$$I_n=c_1a_1^n+c_2a_2^n+\sum_{k=0}^{n-1}\left(\frac{a_1a_2^{n-k-1}-a_2a_1^{n-k-1}}{(k+1)(a_1-a_2)}\right)$$
And so, you need only solve for the initial conditions $c_1$ and $c_2$.
A: Here is an outline for an elementary solution:
We suppose that $$n=3a+b$$ where a is an odd positive integer and b is an integer between 0 and 5 inclusive.
Now the integral becomes
$$I=\int_0^1 \frac{x^n}{x^2-x+1} dx = \int_0^1 (x+1) \frac{x^{3a+b}}{(x+1)(x^2-x+1)} dx = \int_0^1 x^b(x+1) \frac{(x^{3a}+1)-1}{x^3+1} dx$$
$$= \int_0^1 x^b(x+1) \left(\left( \sum_{i=0}^{a-1}{(-x)^{3i}} \right)-\frac{1}{x^3+1} \right) dx\\= \int_0^1 x^b(x+1)\sum_{i=0}^{a-1}{(-x)^{3i}}dx-\int_0^1 \frac{x^b(x+1)}{x^3+1}dx$$
$$= \int_0^1 x^b(x+1)\sum_{i=0}^{a-1}{(-x)^{3i}}dx-\int_0^1 \frac{x^b}{x^2-x+1}dx$$ 
The integrals at this point are all elementary: the one on the right has simple solutions, and the one on the left is just the integral of a polynomial. You should be able to solve it from here. 
Hope this helps.
A: Sketch: Write $I_n = \int_0^1 \frac{x^n}{x^2-x+1}\,dx$, then consider $f(t) = \sum_{n=0}^\infty I_n t^n$:
\begin{align}\sum_{n=0}^\infty I_n t^n&=\sum_{n=0}^\infty \int_0^1 \frac{(xt)^n}{x^2-x+1}\,dx
\\&=\int_0^1\frac{1}{1-xt}\frac{1}{x^2-x+1}\,dx\\
&=-\frac{\sqrt{3} \pi (t-2) + 9t\log(1-t)}{9t^2-9t+9}\end{align}
by partial fractions, and the swap of the limit and sum is justified easily since they are non-negative, so Fubini applies. Then
$$f(t) = -\frac{\frac{\pi}{3 \sqrt{3}}(t-2)+t \log(1-t)}{t^2-t+1}$$
is a generating function for $I_n$, so Taylor expansion gives the integrals each as a finite sum of the form $q + \frac{\pi}{3 \sqrt{3}} a$ for rational $q$ and $a \in \{\pm 1, \pm 2\}$.
A: I have found the general solution to be
$$
I_n=\frac{1}{n+1}\;_3F_2\left(1,1,1+n;1+\frac{n}{2},\frac{3+n}{2},\frac{1}{4}\right)
$$
which contains a hypergeometric function and appears to work for non-integer $n$ as well. This was a byproduct of a yet more general solution. For the integral
$$
I_n(a)=\int_0^1 \frac{x^n}{x^2-x+a} dx
$$
we can take a Mellin transform with respect to $a$ 
$$
\mathcal{M}_a[I_n(a)](s)=\int_0^1 \mathcal{M}_a\left[\frac{x^n}{x^2-x+a}\right](s) dx
$$
$$
\mathcal{M}_a[I_n(a)](s)= \pi \csc(\pi s) \int_0^1  x^n(x^2-x)^{s-1} dx
$$
where the integral is related to the Beta function giving
$$
\mathcal{M}_a[I_n(a)](s)= \frac{(-1)^{s+1}\pi \csc(\pi s) \Gamma(s)\Gamma(n+s)}{\Gamma(n+2s)}
$$
now we take the inverse transform of both sides
$$
I_n(a)= \mathcal{M}^{-1}_s\left[\frac{(-1)^{s+1}\pi \csc(\pi s) \Gamma(s)\Gamma(n+s)}{\Gamma(n+2s)}\right](a)
$$
treating this as a Mellin-Barnes integral defining a hypergeometric function will give
$$
I_n(a)= \frac{1}{(n+1)a}\;_3F_2\left(1,1,1+n;1+\frac{n}{2},\frac{3+n}{2},\frac{1}{4a}\right)
$$
now for your integral, $a=1$, but we also have recovered a more general solution for any $a$, where this solution converges.
