This thesis concerns optimal packing problems of tubes, or thick curves, where thickness is defined as follows. Three points on a closed space curve define a circle. Taking the infimum over all radii of pairwise-distinct point triples defines the thickness Δ. A closed curve with positive thickness has a self-avoiding neighbourhood that consists of a disjoint union of normal disks with radius Δ, which is a tube. The thesis has three main parts. In the first, we study the problem of finding the longest closed tube with prescribed thickness on the unit two-sphere, and show that solutions exist. Furthermore, we give explicit solutions for an infinite sequence of prescribed thicknesses Θn = sin(π/2n). Using essentially basic geometric arguments, we show that these are the only solutions for prescribed thickness Θn, and count their multiplicity using algebraic arguments involving Euler's totient function. In the second part we consider tubes on the three-sphere S3. We show that thickness defined by global radius of curvature coincides with the notion of thickness based on normal injectivity radius in S3. Then three natural, but distinct, optimisation problems for knotted, thick curves in S3 are identified, namely, to fix the length of the curve and maximise thickness, to fix a minimum thickness and minimise length, or simply to maximise thickness with length left free. We demonstrate that optimisers, or ideal shapes, within a given knot type exist for each of these three problems. Finally, we propose a simple analytic form of a strong candidate for a thickness maximising trefoil in S3 and describe its interesting properties. The third and final part discusses numerical computations and their implications for ideal knot shapes in both R3 and S3. We model a knot in R3 as a finite sequence of coefficients in a Fourier representation of the centreline. We show how certain presumed symmetries pose restrictions on the Fourier coefficients, and thus significantly reduce the number of degrees of freedom. As a consequence our numerical technique of simulated annealing can be made much faster. We then present our numeric results. First, computations approach an approximation of an ideal trefoil in S3 close to the analytic candidate mentioned above, but, supporting its ideality, are still less thick. Second, for the ideal trefoil in R3, numerics suggest the existence of a certain closed cycle of contact chords, that allows us to decompose the trefoil knot into two base curves, which once determined, and taken together with the symmetry, constitute the ideal trefoil.