#include <stdio.h>
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,i;
for(i=1;i<=n;i++){
if(rec(i)%i==0){
printf("数列%dの値は%d\n", i
, rec
(i
)); }
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgcmVjKGludCBuKXsKICAgIGlmKG4gPT0gMCl7CiAgICAgICAgcmV0dXJuIDM7CiAgICB9CiAgICBlbHNlIGlmKG4gPT0gMSl7CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CiAgICBlbHNlIGlmKG4gPT0gMil7CiAgICAgICAgcmV0dXJuIDI7CiAgICB9CiAgICBlbHNlIHsKICAgICAgICByZXR1cm4gcmVjKG4tMikgKyByZWMobi0zKTsKICAgIH0KfQoKaW50IG1haW4odm9pZCl7CiAgICBpbnQgbiA9IDUwLGk7Cglmb3IoaT0xO2k8PW47aSsrKXsKCQlpZihyZWMoaSklaT09MCl7CiAgICBwcmludGYoIuaVsOWIlyVk44Gu5YCk44GvJWRcbiIsIGksIHJlYyhpKSk7CgkJfQoJfQogICAgcmV0dXJuIDA7IAp9