The pT-differential production cross section of prompt Λ c + charmed baryons was measured with the ALICE detector at the Large Hadron Collider (LHC) in pp collisions at s√=7 TeV and in p-Pb collisions at sNN−−−√=5.02 TeV at midrapidity. The Λ c + and Λ¯¯¯¯c¯¯¯ were reconstructed in the hadronic decay modes Λ c + → pK−π+, Λ c + → pK S 0 and in the semileptonic channel Λ c + → e+νeΛ (and charge conjugates). The measured values of the Λ c + /D0 ratio, which is sensitive to the c-quark hadronisation mechanism, and in particular to the production of baryons, are presented and are larger than those measured previously in different colliding systems, centre-of-mass energies, rapidity and pT intervals, where the Λ c + production process may differ. The results are compared with the expectations obtained from perturbative Quantum Chromodynamics calculations and Monte Carlo event generators. Neither perturbative QCD calculations nor Monte Carlo models reproduce the data, indicating that the fragmentation of heavy-flavour baryons is not well understood. The first measurement at the LHC of the Λ c + nuclear modification factor, RpPb, is also presented. The RpPb is found to be consistent with unity and with that of D mesons within the uncertainties, and consistent with a theoretical calculation that includes cold nuclear matter effects and a calculation that includes charm quark interactions with a deconfined medium.