Given an n x n matrix, where each cell contains a chocolate. Jim is collecting all the chocolates and he wants to distribute them into sacks such that each sack contains exactly m chocolates (assume that he has unlimited number of sacks) with the exception that the last sack might have fewer chocolates.
Now he is wondering that if he decides to save m chocolates in each sack, what are the possible values of n, such that the last sack always has exactly n chocolates and it is fewer than other sacks (n < m)?