#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define N 100000
int factor[N], sum_of_divisor[N], is_abundant[N], abundant[N];

/* 実験回数の上限 */
#define MAX_NUM 30

int main(int argc, char *argv[]) {
    int i, j, count, n, prime, current, x, ct=0;
    
    for (i = 2; i < N; ++i) {
        if (factor[i] == 0) {
            factor[i] = i;
            for (j = i + i; j < N; j += i) factor[j] = i;
        }
    }

    srand((unsigned)time(NULL));

    sum_of_divisor[1] = 1;
    count = 0;
    for (i = 2; i < N; ++i) {
        prime = factor[i], current = i, x = 1;
        while (current % prime == 0) {
            current /= prime;
            x = x * prime + 1;
        }
        sum_of_divisor[i] = x * sum_of_divisor[current];
        if (sum_of_divisor[i] > i + i) {
            abundant[count++] = i;
            is_abundant[i] = 1;
        }
    }
    
    n = 0;
      while (ct++ < MAX_NUM) {
        n = rand()%N+20161;
        for (i = 0; i < count; ++i) {
            if (abundant[i] >= n) break;
            if (is_abundant[n - abundant[i]] == 1) {
                printf("%d = %d + %d\n", n, abundant[i], n - abundant[i]);
                break;
            }
        }
    }
    return 0;
}
