fork download
  1. #include <stdio.h>
  2. //課題4
  3. int rec(int n){
  4. if(n==0){return 3;}
  5. else if(n==1){return 0;}
  6. else if(n==2){return 2;}
  7. else{return rec(n-2)+rec(n-3);}
  8. }
  9.  
  10. int main(void) {
  11. int n = 50;
  12. for(int i = 1; i <= n; i++){
  13. if (rec(i) % i == 0){printf("%d ", i);}
  14. }
  15.  
  16. return 0;
  17. }
  18.  
  19.  
Success #stdin #stdout 0.03s 5288KB
stdin
Standard input is empty
stdout
1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47