Continued Fraction Expansions

I am a newbie at LaTex. I would like to know how to perform the following on native tex. Pls help me out. Thanks

• By "native tex" do you mean to exclude LaTeX answers, limiting acceptable solutions to tex core code only? Or, by "native tex", do you mean LaTeX without additional packages? – Steven B. Segletes Jul 6 '16 at 13:54
• Welcome to TeX.SX! Some people take exception to questions of the form "Please do this for me". You will get more help if you post some code showing what you have tried and give a minimal working example. Btw, if you search for continued fractions on the site you will almost certainly find what you are looking for. – Andrew Jul 6 '16 at 14:02

If you are willing to use LaTeX-packages, you could have a look at the polynom-package.

Note that you can always locate the documentation using the command-line/terminal by writing texdoc polynom, and that works for any package. The documentation is also available at http://ctan.org/pkg/polynom

The following example is taken from a question I answered earlier, Using \polyremainder in polynom package

Output

Code

\documentclass[11pt]{article}
\usepackage{polynom}
\begin{document}
\polyadd\polya { (X^2+X+1)(X-2) }{0}
\polyadd\polyb { X-1 }{0}

Dividing \polyprint\polya{} by \polyprint\polyb.
$\polylongdiv\polya\polyb$

\polydiv\polyc{ (X^2+X+1)(X-2) }{ X-1 }
Remainder is: \polyprint{\polyremainder}
\end{document}