I read a little bit about packing spheres into cubes, but I imagine the problem changes drastically when trying to fill a sphere with unit cubes. For example, how many unit cubes could one fit into a sphere of radius five? Clearly the upper limit would be $\left \lfloor \frac{4}{3}\pi \cdot 5^3 \right \rfloor$, but I imagine there will be plenty more empty space than just a small fraction of a cube.
[Math] How to pack a sphere with cubes
geometrypacking-problem
Related Solutions
One way of finding out whether two Bezier curves sharing the endpoints intersect is to calculate all the intersections of two general Bezier curves and discard the $0$ and $1$ parameters from the solutions.
One way of calculating the intersections of two Bezier curve is the well known "subdivision" method: when the convex hulls of two Bezier curves do not overlap, the curves cannot overlap neither. If they do overlap, subdivide both the curves with De Casteljau's algorithm and recurse with all the combinations so that you check each part of the first curve with each of the parts of the second curve. Stop if convex hulls are small enough or if they can be approximate by a line segment, in which case simply compute their intersection.
Alternatively, as you are interested in a visual setting, chop off the ends of one of the curves (i.e., remove the parts with parameter $[0, \epsilon]$ and $[1-\epsilon, 1]$, where $\epsilon$ is a small number), so that you don't look for intersection at the endpoints only to discard them later.
More on intersection methods of Bezier curves can be found in Comparison of three curve intersection algorithms by Sederberg and Parry (1986).
Let $\mathcal{R}_n = \lim\limits_{k\to\infty} R(n,k)$. Your numbers on $\mathcal{R}_n$ doesn't feel right for $n \ge 3$.
For any fixed $n$ and large $k$, the centers of the small spheres of radius $r$ should be constrained to a sphere of radius $1-r$. To the small spheres, the space between two spherical shell of radius $1$ and $1-2r$ will look flat. So the optimal $(r,k)$ configuration will correspond to some sort of close packing of $S^{n-2}$ in a $\mathbb{R}^{n-1}$.
Let $\rho_{n}$ be the optimal packing density of $S^{n-1}$ in $\mathbb{R}^n$. Let $\displaystyle\sigma_n = \frac{\pi^{n/2}}{\Gamma(\frac{n}{2}+1)}$ be the volume of the unit $n$-ball in $\mathbb{R}^n$. We know the "surface area' of the unit $n$-ball is given by $n\sigma_n$. This leads to $$\begin{align} & \sigma_{n-1} k\,r^{n-1} \approx n\sigma_n (1-r)^{n-1} \times \rho_{n-1} \\ \implies & \mathcal{R}_n = \lim_{k\to\infty} k\,r^{n-1}(n,k) \approx n\frac{\sigma_n}{\sigma_{n-1}}\rho_{n-1} = \frac{2\sqrt{\pi}\,\Gamma\left(\frac{n+1}{2}\right)}{\Gamma\left(\frac{n}{2}\right)}\rho_{n-1} \end{align}$$
It is known that $\rho_1 = 1$, $\displaystyle \rho_2 = \frac{\pi}{2\sqrt{3}}$, $\displaystyle \rho_3 = \frac{\pi}{\sqrt{18}}\color{blue}{^{[1]}}$ and $\displaystyle \rho_8 \approx \frac{\pi^4}{384} ( 1 + O(10^{-14}) )\color{blue}{^{[2]}}$. This give us an estimate
$$\mathcal{R}_n \approx \begin{cases} \pi,&n = 2\\ \\ \frac{2\pi}{\sqrt{3}},& n = 3\\ \\ \frac{\pi^2}{4\sqrt{2}}, & n = 4\\ \\ \frac{2\pi^4}{105},&n = 9 \end{cases}$$ Something very different from your guess when $n \ge 3$.
About what happens to $\mathcal{R}_n$ for large $n$, we know that for $n \ge 115$, there is an upper bound for $\rho_n$ of the form$\color{blue}{^{[3]}}$:
$$\rho_n \le 2^{-(0.5990\ldots + o(1))n}$$ This means $\mathcal{R}_n$ converges to $0$ as $n$ tends to infinity.
Notes
$\color{blue}{[1]}$ T.C. Hales, A proof of the Kepler conjecture, Ann. of Math. (2) 162 (2005), 1065-1185. MR2179728 doi:10.4007/annals.2005.162.1065.
$\color{blue}{[2]}$ the packing density $\frac{\pi^4}{384}$ is achieved by regular packing of spheres on an $E_8$ lattice in $\mathbb{R}^8$. The $O(10^{-14})$ error bound is given by H.Cohn and A. Kumar but I don't know the exact reference.
$\color{blue}{[3]}$ G.A.Kabatyanskii and V.I.Levenshetin. Bounds for packings on a sphere and in space (Russian), Problemy Peredaci Informacii 14 (1978), 3-25; English translation in Problems of Information Transmission 14 (1978), 1-17, MR0514023.
Best Answer
While there is no obvious reason in general to expect the optimal solution to be a simple, closely-packed formation, there are grounds for thinking that this is more likely in the case of radius 5 (diameter 10). Suppose we look for a formation of overlapping cuboids, each centred at the centre of the sphere, the whole formation being symmetric in three orthogonal directions (in other words, invariant under any series of right-angle rotations). The maximum possible length of a cuboid that fits within a sphere of diameter 10 is 9. Since this is an odd integer, we consider formations having a cube with its centre at the centre of the sphere (rather than those with 8 cubes sharing a vertex at the centre of the sphere). For symmetry as described, this requires cuboids with odd integer dimensions, at least two of the dimensions being equal.
Using Pythagoras’s Theorem to find the long diagonal of a cuboid, and since the sum of three odd squares is odd, no such cuboid can have a long diagonal of length 10. By trial and error, or using Brahmagupta’s Identity given that:
$$99 = 11 \times 9 = (3^2 + 2(1^2))3^2 = (3^2 + 2(1^2))(1^2 + 2(2^2))$$
there are, remarkably, three such cuboids with long diagonal $\sqrt{99}\approx9.9499$, namely:
$$9 \times 3 \times 3 \qquad 7 \times 5 \times 5 \qquad 1 \times 7 \times 7$$
This suggests a formation of nine overlapping cuboids, comprising three of each of the above sizes. One way to describe the formation and count its cubes is as follows:
Start with a cube of side 5, centred within the sphere (125 cubes).
On each of its faces, add a 5 x 5 block of cubes (plus 6 x 25 = 150 cubes). This gives the three 7 x 5 x 5 cuboids. The result can also be described as a cube of side 7, but with all cubes along its edges missing.
Add 1 cube at the middle of each of the above “missing edges” (plus 12 cubes). This gives the three 7 x 7 x 1 cuboids.
In the centre of each of the main 5 x 5 faces of the resulting solid, add a 3 x 3 block of cubes (plus 6 x 9 = 54 cubes). This gives the 9 x 3 x 3 cuboids.
The resulting formation contains 125 + 150 + 12 + 54 = 341 cubes.
Perhaps this is not optimal for a sphere of radius 5, but the fact that each vertex of each of the nine cuboids (72 points in all) is within $(10-\sqrt{99})/2\leq0.026$ of the surface of the sphere suggests that it may be hard to beat.
Update 16 March 2017 The above solution turns out not to be optimal. Note that it arranges the cubes, along each of three orthogonal axes which will be called X, Y and Z, into nine "slices", each of one cube thickness. The configuration of the second and eighth slices along each axis (six slices in all) is as below.
Two extra cubes can be added in each slice by sliding two rows of cubes a distance of half a cube length, producing the configuration below.
To make this possible on each of the six faces, care is needed to avoid a change in one slice blocking a change in a face at right angles to it. One way to achieve this is:
In terms of overlapping cuboids, this gives three 7 x 6 x 3 cuboids, centred at the centre of the sphere, with long diagonals of length $\sqrt{94}<10$.
Altogether, this adds 6 x 2 = 12 cubes.
The first and ninth slices on each axis consist of a 3 x 3 block of cubes. In a similar way, a cube can be added to each block by sliding a central row of three cubes half a cube length. The resulting extra cuboids have dimensions 9 x 4 x 1, with long diagonal $\sqrt{98}<10$. This adds a further 6 cubes.
The formation resulting from these changes has 341 + 12 + 6 = 359 cubes.