We establish the optimal regularity of solutions to the Neumann problem for the fractional Laplacian, (−Δ)su=h in Ω, with the external condition Nsu=0 in Ωc. For this, a key point is to establish a 1D Liouville theorem for functions with growth, which we prove by using complex analysis and the Mellin transform. More precisely, we prove a ``meta-theorem'' relating the classification of 1D solutions to general linear homogeneous equations of the type Lu=0 in (0,∞) to the (complex) roots of an explicit meromorphic function f(z) that depends on L. In case of the fractional Laplacian with Neumann conditions, we show that all solutions are C2s+α when s≤1/2, and Cs+21+α when s≥1/2. Moreover, quite surprisingly, we prove that even in 1D there exist highly oscillating solutions of the type u(x)=xacos(blogx) for x>0, with a>0 and b>0 that depend on s, and a<2s for s∼1.