The converse of Newton's shell theorem The shell theorem states that a spherically symmetric body $S$ of mass $m$ has a gravitational field identical to that of a point particle $P$ of mass $m$ located at the center of $S$.
We can ask the converse question: suppose there is a force $F$ between masses $M$ and $m$, separated by a distance $r$ of the form $$F = M m f ( r )$$  such that any spherically symmetric body affects external bodies as if its mass were concentrated at its center. Then what form can the function $f$ take?
According to Wikipedia: https://en.wikipedia.org/wiki/Shell_theorem, the general solution is 
$$f(r)=a/r^2+br$$
where $a$ and $b$ are constants. 
I attempted to demonstrate this. Replacing the gravitational force with the general force $F=Mmf(r)$ in the calculations to prove the shell theorem, I got that for all distances $r \ge R > 0$, $f$ satisfies:
$$\int_{r-R}^{R+r} (r^2-R^2 +s^2) f(s)\ ds = 4r^2Rf(r).$$
We can take the second derivative of both sides with respect to $r$ to get rid of the integral (we'll need to differentiate inside the integral), and we get the following nasty differential equation:
$$2Rrf''(r)+6Rf'(r)=f'(r+R)(r+R)+2f(r+R)-f'(r-R)(r-R)-2f(r-R).$$
I don't think this really helps. We can easily verify that $f=ar^2+br$ is a solution of this equation, so I didn't make any mistakes thus far (note the equation is linear so it suffices to check it for $f=r$ and $f=1/r^2$).
So how can we demonstrate the result?
 A: This follows from Gauss's law.  The $1/r^2$ part would be for a Gaussian sphere of radius greater the radius if the source, while the $r$ part follows from having a Gaussian sphere with radius inside the source, assuming uniform mass density.
The best way to show this is to start from the differential equation for the potential in spherical coordinates assuming spherical symmetry; this would be the Laplace equation outside and the Poisson equation with a constant term on the right inside the source.  Once you have the potential you can get the force through the gradient.

Edit.  Start from
\begin{align}
\nabla^2V(r)&=0\, ,\\
\frac{1}{r^2}\frac{d}{dr}\left(r^2\frac{dV}{dr}\right)&=0\, ,\\
r^2\frac{dV}{dr}&=-a\, ,
\end{align}
for some constant $a$.  This is enough to give you the force as $\sim 1/r^2$ outside the source since $F_r=-\frac{dV}{dr}$.
Inside, you need to find a particular solution to 
$$
\nabla^2V=4\pi G\,\rho_m
$$
where $\rho_m$ is the mass density.  By inspection $dV/dr=4\pi G\rho_m\,r/3$ will work; this entails $F_r=br$ inside the source.  The general solution with $\rho_m\ne 0$ is then the sum of the particular solution and the sum of the homogenous problem.
A: In this answer, we give a proof of the converse shell theorem for an exterior point mass summing over forces rather than potentials, in the spirit of OP's calculation.
Sketched proof: We use the same notation as the Wikipedia page and my other Phys.SE answer. We consider the outside of a thin shell, i.e. $r\geq R$. Define for later convenience the antiderivative
$$W(s)~:=~-\int^s\! ds^{\prime}~(s^{\prime})^2~ f(s^{\prime}), 
\tag{2.1}$$
so that
$$W^{\prime}(s)~\stackrel{(2.1)}{=}~- s^2~f(s).\tag{2.2}$$
The cosine relation yields
$$ \cos\phi ~=~\frac{s^2+r^2-R^2}{2sr}.\tag{2.3} $$
The radial contribution $dF_r$ to the force on the mass $m$ from the ring $dM$ with distance $s$ is of the form
$$ \begin{align}dF_r~=~& -m~dM~f(s)~\cos\phi\cr
~\stackrel{(1.5)}{=}& -m~\frac{M}{2}\frac{s~ds}{rR}~f(s)~\cos\phi \cr
~\stackrel{(2.3)}{=}&-\frac{mM}{4r^2R}~ds~f(s)~(s^2+r^2-R^2)\cr
~\stackrel{(2.2)}{=}&\frac{mM}{4r^2R}~ds\left[W^{\prime}(s)+(r^2-R^2)u^{\prime}(s)\right].\end{align}\tag{2.4}$$
The total radial force should be independent of $R$:
$$ \begin{align}F_r(r)~=~&\int \! dF_r\cr
~\stackrel{(2.4)}{=}&\frac{mM}{4r^2R}~\int_{r-R}^{r+R} \! ds\left[W^{\prime}(s)+(r^2-R^2)u^{\prime}(s)\right] \cr
~=~&\frac{mM}{4r^2R}\left[W(r\!+\!R)-W(r\!-\!R)+(r^2-R^2)\left(u(r\!+\!R)-u(r\!-\!R)\right)\right] \cr
~=~&\frac{mM}{2r^2}\left[W^{\prime}(r)+\frac{R^2}{6}W^{\prime\prime\prime}(r)+(r^2-R^2)\left(u^{\prime}(r)+\frac{R^2}{6}u^{\prime\prime\prime}(r)\right)+{\cal O}(R^4)\right]\cr
~=~&\frac{mM}{2}\left[\underbrace{r^{-2}W^{\prime}(r)+u^{\prime}(r)}_{=~-2f(r)}+R^2 (\ldots)+{\cal O}(R^4)\right].\end{align} \tag{2.5}$$
Therefore the ellipses $(\ldots)$ in eq. (2.5) must vanish:
$$ \begin{align}0~=~&(\ldots) \cr
~\stackrel{(2.5)}{=}& \frac{W^{\prime\prime\prime}(r)}{6r^2}- \frac{u^{\prime}(r)}{r^2} +\frac{u^{\prime\prime\prime}(r)}{6} \cr
~\stackrel{(2.2)}{=}& -\frac{1}{6r^2}\frac{d^2(r^2f(r))}{dr^2}+ \frac{f(r)}{r^2} -\frac{f^{\prime\prime}(r)}{6} \cr
~=~& \frac{1}{3}\left( \frac{2f(r)}{r^2}-\frac{2f^{\prime}(r)}{r} -f^{\prime\prime}(r)\right)\cr
~=~& -\frac{d}{dr}\left(\frac{1}{3r^2} \frac{d(r^2f(r))}{dr}\right)\cr
~\stackrel{(2.2)}{=}& \frac{d}{dr}\left(\frac{W^{\prime\prime}(r)}{3r^2}\right).\end{align} \tag{2.6}$$
Hence
$$ W^{\prime\prime}(r)~\stackrel{(2.6)}{\propto}~r^2 ,\tag{2.7}$$
so that
$$ W^{\prime}(r)~\stackrel{(2.7)}{=}~\alpha r^3+\beta. \tag{2.8}$$
Or in terms of the specific force
$$ -f(r)~\stackrel{(2.2)}{=}~\frac{W^{\prime}(r)}{r^2}~\stackrel{(2.8)}{=}~\alpha r+\frac{\beta}{r^2}. \tag{2.9}$$
$\Box$
So can we understand this result (2.9) intuitively? Yes:

*

*The Coulomb law comes from Gauss' law.


*The Hooke's law $\vec{f}(\vec{r})=-k\vec{r}$ works for every extended mass $M$ (not necessarily a spherically symmetric shell) that is invariant under spatial point reflection $\vec{R}\to -\vec{R}$. This follows from linearity: Two antipodes $\vec{f}(\vec{r}\!+\!\vec{R})+\vec{f}(\vec{r}\!-\!\vec{R})=2\vec{f}(\vec{r})$ contribute as much as twice the midpoint(=center).
A: 
Converse shell theorem for an interior point mass:

*

*Assume that the force ${\bf F}_{12}$ between two point masses $m_1$ and $m_2$ is collinear with the difference in positions ${\bf r}_{12}:={\bf r}_1-{\bf r}_2$, is central, and the magnitude
$$|{\bf F}_{12}|=m_1m_2 f(|{\bf r}_{12}|)\tag{*}$$
is proportional to both the two point masses. We call the function  $f(|{\bf r}_{12}|)$ the specific force.


*Assume furthermore that the total force between an extended spherically symmetric mass $M$ and an interior point mass $m$ vanish.


*Then the specific force $f$ is an inverse square/Newtonian gravity force.

Sketched proof: We use the same notation as the Wikipedia page and my other Phys.SE answer. We consider the inside of a thin shell, i.e. $r\leq R$.
The total radial force should be zero:
$$\begin{align} 0~=~&F_r(r)\cr
~=~&\int \! dF_r\cr
\stackrel{(2.4)}{=}&\frac{mM}{4r^2R}~\int_{R-r}^{R+r} \! ds\left[W^{\prime}(s)+(r^2-R^2)u^{\prime}(s)\right]\cr
~=~&\frac{mM}{4r^2R}\left[W(R\!+\!r)-W(R\!-\!r)+(r^2-R^2)\left(u(R\!+\!r)-u(R\!-\!r)\right)\right] \cr
~=~&\frac{mM}{2rR}\left[W^{\prime}(R)+\frac{r^2}{6}W^{\prime\prime\prime}(R)+(r^2-R^2)\left(u^{\prime}(R)+\frac{r^2}{6}u^{\prime\prime\prime}(R)\right)+{\cal O}(r^4)\right]\cr
~=~&\frac{mM}{2rR}\left[\underbrace{W^{\prime}(R)-R^2u^{\prime}(R)}_{=~0}+r^2 (\ldots)+{\cal O}(r^4)\right].\end{align}\tag{3.1}$$
In particular the ellipsis $(\ldots)$ in eq. (3.1) must vanish:
$$\begin{align} 0~=~&(\ldots) \cr
~\stackrel{(3.1)}{=}& \frac{W^{\prime\prime\prime}(R)}{6}+ u^{\prime}(R) -R^2\frac{u^{\prime\prime\prime}(R)}{6} \cr
~\stackrel{(2.2)}{=}&-\frac{1}{6}\frac{d^2(R^2f(R))}{dR^2}-f(R)+R^2\frac{f^{\prime\prime}(R)}{6}\cr
~=~&-\frac{2}{3}\left(2f(R) +Rf^{\prime}(R)\right)\cr
~=~&-\frac{2}{3R}\frac{d(R^2f(R))}{dR}\cr
~\stackrel{(2.2)}{=}&\frac{2W^{\prime\prime}(R)}{3R}.\end{align}\tag{3.2}$$
Hence
$$W^{\prime}(R)~\stackrel{(3.2)}{=}~ {\rm constant},\tag{3.3}$$
and therefore the specific force
$$f(R)~\stackrel{(2.2)}{=}~-\frac{W^{\prime}(R)}{R^2}~\stackrel{(3.3)}{\propto}~ R^{-2}\tag{3.4}$$
is an inverse square force. $\Box$
A: 
Converse shell theorem for an exterior point mass:

*

*Assume that the force ${\bf F}_{12}$ between two point masses $m_1$ and $m_2$ is collinear with the difference in positions ${\bf r}_{12}:={\bf r}_1-{\bf r}_2$, is central, and the magnitude
$$|{\bf F}_{12}|=m_1m_2 f(|{\bf r}_{12}|)\tag{*}$$
is proportional to both the two point masses. We call the function  $f(|{\bf r}_{12}|)$ the specific force.


*Assume furthermore that the magnitude of the total force between an extended spherically symmetric mass $M$ and an exterior point mass $m$ is of the same form $$|{\bf F}|=mM f(r),\tag{**}$$
where $r\equiv |{\bf r}|$ is the distance between $m$ and the center of $M$.


*Then the specific force $f$ is a linear combination of

*

*a linear/Hooke force,


*an inverse square/Newtonian gravity force.

Sketched proof: Let us use the same notation as the Wikipedia page. We consider the outside of a thin shell, i.e. $r\geq R$.

Let us for simplicity work in terms of potential energy (rather than force), because it is easier to work with a scalar (rather than a vector) quantity. We may assume that the contribution $dU$ to the potential energy of the mass $m$ and $dM$ with distance $s$ is of the form
$$ dU~=~m~dM~u(s),\tag{1.1}$$
where $s\mapsto u(s)$ is an unknown specific potential. Define for later convenience the antiderivative
$$V(s)~:=~\int^s\! ds^{\prime}~s^{\prime}~ u(s^{\prime}), 
\tag{1.2}$$
so that
$$V^{\prime}(s)~\stackrel{(1.2)}{=}~s~u(s).\tag{1.3}$$
From geometry we have the cosine relation
$$ \cos\theta ~=~\frac{r^2+R^2-s^2}{2rR},\tag{1.4} $$
and therefore
$$dM ~=~ \frac{M}{2}\sin\theta~ d\theta
~=~-\frac{M}{2}~d\cos(\theta)
~\stackrel{(1.4)}{=}~\frac{M}{2}\frac{s~ds}{rR}.\tag{1.5}$$
In the last equality of eq.(1.5) we varied $s$ and $\theta$ while holding $r$ and $R$ fixed. Then we have
$$dU~\stackrel{(1.1)+(1.5)}{=}~\frac{mM}{2}\frac{s~ds}{rR}~u(s)
~\stackrel{(1.3)}{=}~\frac{mM}{2rR}ds~V^{\prime}(s).\tag{1.6}$$
So the total potential energy is
$$U(r,R)~=~\int dU
~\stackrel{(1.6)}{=}~mM\frac{V(r+R)-V(r-R)}{2rR}$$
$$~\stackrel{(1.8)}{=}~\frac{mM}{r}\left(V^{\prime}(r)+ \frac{R^2}{6}V^{\prime\prime\prime}(r)+ {\cal O}(R^5)\right).\tag{1.7}$$
In the last equality of eq. (1.7), we Taylor-expanded the potential
$$V(r\pm R)~=~V(r) \pm RV^{\prime}(r) + \frac{R^2}{2}V^{\prime\prime}(r) \pm \frac{R^3}{6}V^{\prime\prime\prime}(r)+ {\cal O}(R^4). \tag{1.8}$$
Let us now implement the main converse shell assumption: We assume that the potential energy $U(r,R)$ up to an ambiguity in the choice of zero-point energy $U_0(R)$ does not depend on the radius $R$ of the thin shell, i.e. $U(r,R)$ is of the form
$$U(r,R)~=~U_1(r)+U_0(R) .\tag{1.9} $$
We see that the only way that eq. (1.7) could be of the form (1.9) is iff
$$ V^{\prime\prime\prime}(r)~\stackrel{(1.7)+(1.9)}{\propto}~r,\tag{1.10} $$
i.e. $V^{\prime}$ is a 3rd-order polynomial with a missing 2nd-order term:
$$ V^{\prime}(r)~\stackrel{(1.10)}{=}~Ar^3+Br^2+Cr+D\tag{1.11}, \qquad B~=~0. $$
Or in terms of the specific potential
$$ u(r)~\stackrel{(1.3)+(1.11)}{=}~Ar^2+C+\frac{D}{r}\tag{1.12}. $$
Or in terms of the specific force
$$ -f(r)~=~u^{\prime}(r)~\stackrel{(1.12)}{=}~2Ar-\frac{D}{r^2}\tag{1.13}. $$
$\Box$
