The Sm and Yb ions have a different electronic structure ( the different number of 4f electrons on this core). So to calculate their magnetic moments we must use Hunder rules for determination S, L, J numbers and g-factor of their electron configuration.
For Dr. Sachin Gupta :Both the answers add up to make a complete/ correct answer but perhaps you forgot to give a relation to calculate ‘ g’ from L, S,J values.So grateful vote up, my young friend.
For Dr. Olga Dyogteva: But for confusing Sm for Ce, your self were following the right method.