Java Chocolates By Numbers
public class Solution {
    public static int chocolatesByNumbers(int n, int m) {
        long gcd = gcd(n, m);
        long result = ((long) n * m / gcd) / m;

        return (int) result;
    }

    private static long gcd(long n, long m) {
        if (n % m == 0) {
            return m;
        }

        return gcd(m, n % m);
    }
}

This uses the greatest common divisor to figure out how many chocolates get eaten before the pattern repeats.