\documentclass{article}
\title{Title of Document}
\author{Name of Author}
\usepackage{sagetex}
\begin{document}
\maketitle
heh -- This is a test.
This year is $2016=\sage{factor(2016)}$.
heh -- now I'm typing a lot
$\sage{3+3}$
heh -- Consider $x^3$.
heh -- now I'm typing a lot
heh -- Blah.
heh --
heh -- Yes, I will! now I'm typing a lot
Ok now I'm typing a lot
\end{document}