Javascript code to render prime factor trees from arbitrary integers and render them to a canvas