Question about finding the primitives of a given function, whether or not elementary.

The indefinite integral is defined as a set of all functions $F$ such that $F' = f$. Each member of the set is called an antiderivative. For example, $$\int f(x) dx = \lbrace F(x): F'(x) = f(x) \rbrace$$ also commonly denoted as $$F(x) + C.$$

If $F'(z) = f(z)$ then we denote

$$\int f(z) \; dz = F(z)$$

and call $F(z)$ a primitive of $f(z)$, also called an antiderivative. This result, while taught early in elementary calculus courses, is actually a very deep result connecting the purely algebraic indefinite integral and the purely analytic (or geometric) definite integral.

Since the derivative of a constant is zero, any constant may be added to an antiderivative and will still correspond to the same integral. Another way of stating this is that the antiderivative is a nonunique inverse of the derivative. For this reason, indefinite integrals are often written in the form $$\int f(z)\;dz=F(z)+C$$

where $C$ is an arbitrary constant known as the constant of integration.

It may happen that there is no elementary function$^1$ such that $$\int f(z) \; dz = F(z)$$ In such case, we define a new function which is not elementary but still satisfies our definition. For example, there is no elementary function $F$ such that $F'(z) = \displaystyle \frac{e^z}{z}$. However, if we define

$$\int \frac{e^z}{z} dz = C + \log z + \int_0^z \frac{e^t-1}{t} dt$$

we can readily check that $F' = f$.

$^1$: A function built up of a finite combination of constant functions, field operations (addition, multiplication, division, and root extractions - the elementary operations) and algebraic, exponential, and logarithmic functions and their inverses under repeated compositions. See also.

Source: Wolfram Mathworld