# Latex - prime factor tree

• Apr 21st 2010, 08:52 AM
Kcal
Latex - prime factor tree
Dear Forum,

I'm very new to Latex and trying hard to learn how present math documents for assessment.

Can anyone tell me how to display a prime factor tree? For example:

630 is 2x3x3x5x7 and I'd like to display the factors using arrows in a neat diagram.

Thanks in advance for any help.
• Apr 21st 2010, 12:10 PM
wonderboy1953
Question
Have you read the LaTex tutorial?
• May 16th 2010, 06:30 AM
Kep
Quote:

Originally Posted by wonderboy1953
Have you read the LaTex tutorial?

The LaTeX tutorial doesn't show you how to do this (Crying).

Personally, I have no idea. My LaTeX learning so far has focused on typesetting text impeccably.
• May 17th 2010, 04:09 AM
flyingsquirrel
Quote:

Originally Posted by Kcal
Can anyone tell me how to display a prime factor tree? For example:

It can be done using the package PGF.

Here is an example :
Code:

\documentclass{article} \usepackage{tikz} \begin{document} \begin{figure}     \centering     \begin{tikzpicture}[         level 1/.style={sibling distance=20mm},         level 2/.style={sibling distance=10mm},     ]     \node{80}         child{node {8}             child{node {2}}             child{node {2}}             child{node {2}}         }         child{node {10}             child{node {2}}             child{node {5}}         };     \end{tikzpicture}     \caption{Simple tree} \end{figure} \begin{figure}     \centering     \begin{tikzpicture}[         level 1/.style={sibling distance=40mm},         level 2/.style={sibling distance=20mm},         level 3/.style={sibling distance=10mm}         ]     \node[rounded corners, draw]{720}         child{node [rounded corners, draw] {20}             child{node [fill=red!30,rounded corners] {2}}             child{node [rounded corners, draw] {10}                 child{node [fill=red!30,rounded corners] {5}}                 child{node [fill=red!30,rounded corners] {2}}             }         }         child{node [rounded corners, draw] {36}             child{node [rounded corners, draw] {6}                 child{node [fill=red!30,rounded corners] {2}}                 child{node [fill=red!30,rounded corners] {3}}             }             child{node [rounded corners, draw] {6}                 child{node [fill=red!30,rounded corners] {2}}                 child{node [fill=red!30,rounded corners] {3}}             }         };     \end{tikzpicture}     \caption{Elaborated tree} \end{figure} \end{document}