@Override
    public Long solve() {

        final int N = 10000000;
        
        final long[] M = new long[N+1];
        for (int n = 2; n <= N; ++n) M[n] = 1;
        
        final long[][] divisors = new long[N][];
        divisors[1] = new long[] {1L};

        final int[] biggestPrimeFactor = new int[N];
        
        for (int a = 2; a < N; ++a) {
            if (biggestPrimeFactor[a] == 0) {
                for (int i = a; i < N; i += a) {
                    biggestPrimeFactor[i] = a;
                }
            }
            
            final int prime = biggestPrimeFactor[a];
            final long[] divs = divisors[a / prime];

            divisors[a] = findDivisors(divs, prime);
            
            for (long d1: divisors[a-1]) {
                for (long d2: divisors[a]) {
                    long d = d1 * d2;
                    if (a < d && d <= N) {
                        M[(int)d] = a;
                    }
                }
            }
        }

        long sum = 0;
        
        for (int n = 1; n <= N; ++n) sum += M[n];

        return sum;
    }