Vertical dots in a tree with forest

I am writing a paper about the collatz conjecture, and I want to show a diagram, but I don't know how to add ellipses to the tree.

\usepackage{forest}

\begin{forest} for tree={
edge path={\noexpand\path[\forestoption{edge}] (\forestOve{\forestove{@parent}}{name}.parent anchor) -- +(0,-12pt)-| (\forestove{name}.child anchor)\forestoption{edge label};}
}

[1
[2
[4
[8
[16
[32
[64
[128
[256]
]
[21
[42]
]
]
]
[5
[10
[20
[40]
]
[3
[6]
]
]
]
]
]
]
]
]

\end{forest}


I want the ellipses to be where the red rectangles are, if possible

The simplest solution is just to add them to the terminal nodes directly. By using align=center you can use linebreaks inside nodes. I've also made all content math, which simplifies the code slightly.

I've removed your path code which gave errors and doesn't seem to do much.

\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={math content,align=center}
[1
[2
[4
[8
[16
[32
[64
[128
[256\\\vdots]
]
[21
[42\\\vdots]
]
]
]
[5
[10
[20
[40\\\vdots]
]
[3
[6\\\vdots]
]
]
]
]
]
]
]
]
\end{forest}

\end{document}


• When I add this, the ellipses appear inline with the numbers and not below them. the linebreaks dont seem to work. The new line appears above the number instead of below. Edit: Nevermind, it works, thank you – Adam Zaidi Jul 23 '20 at 0:47
• @AdamZaidi you need align = center . – Alan Munn Jul 23 '20 at 0:53