Rabu, 13 November 2024

Prime Factor Tree In Latex

  •  Type this following latex code for drawing Prime Factor Tree using Latex editor:
%! TEX TS-program=pdflatex 
% pdflatex primeFactorTree1prv.tex

\documentclass{article}

\usepackage{tikz}

\usepackage{tgbonum}


% -------------------

% Each unique / separated page for each tikzpicture

% -------------------

\usepackage[active,tightpage,pdftex]{preview}

\PreviewEnvironment{tikzpicture}

\setlength\PreviewBorder{0.15pt}


% bold font for entire document

\renewcommand{\seriesdefault}{bx}


\begin{document}


% -------------------

% typing a title

% -------------------

\begin{figure}

\begin{tikzpicture}[thick]

\node{Prime Factor Tree};

\end{tikzpicture}

\end{figure}


\begin{figure}

\begin{tikzpicture}[thick]

% dividend number

\node{120}

child { node[circle, draw=red] {2} } % prime factor number

child { node{60} % dividend number

child { node[circle, draw=red] {2} } % prime factor number

child { node[circle] {30} % dividend number

child {

node[circle, draw=red] {2} % prime factor number

}

child { node[circle] {15} % dividend number

child { node[circle, draw=red] {3}} % prime factor number

child { node[circle, draw=red] {5} } % prime factor number

}

}

};

\end{tikzpicture}

\end{figure}

\end{document}

  • save file as primeFactorTree1prv.tex
  • then build or typeset the Latex code.

Output


Prime Factor Tree





Related Post

Tidak ada komentar:

Posting Komentar

Various Other Posts