#include <stdio.h>
int c = 0;
// rec関数の定義
int rec(int n) {
if (n == 0) {
return 3;
} else if (n == 1) {
return 0;
} else if (n == 2) {
return 2;
} else {
return rec(n - 2) + rec(n - 3);
}
}
int main(void) {
int n = 50;
for (int i = 1; i <= n; i++) {
int value = rec(i);
if (value % i == 0) {
c++;
}
}
printf("Total count of n where a(n) is divisible by n: %d\n", c
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgYyA9IDA7CgovLyByZWPplqLmlbDjga7lrprnvqkKaW50IHJlYyhpbnQgbikgewogIAogICAgaWYgKG4gPT0gMCkgewogICAgICAgIHJldHVybiAzOwogICAgfSBlbHNlIGlmIChuID09IDEpIHsKICAgICAgICByZXR1cm4gMDsKICAgIH0gZWxzZSBpZiAobiA9PSAyKSB7CiAgICAgICAgcmV0dXJuIDI7CiAgICB9IGVsc2UgewogICAgICAKICAgICAgICByZXR1cm4gcmVjKG4gLSAyKSArIHJlYyhuIC0gMyk7CiAgICB9Cn0KCmludCBtYWluKHZvaWQpIHsKICAgIGludCBuID0gNTA7CiAgIAogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgaW50IHZhbHVlID0gcmVjKGkpOwogICAgICAgIGlmICh2YWx1ZSAlIGkgPT0gMCkgewogICAgICAgICAgICBjKys7CiAgICAgICAgfQogICAgfQogICAgCiAgIAogICAgcHJpbnRmKCJUb3RhbCBjb3VudCBvZiBuIHdoZXJlIGEobikgaXMgZGl2aXNpYmxlIGJ5IG46ICVkXG4iLCBjKTsKICAgIAogICAgcmV0dXJuIDA7Cn0K