OFFSET
1,8
LINKS
Yifan Xie, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
There are 3 ways to reach 12: (1*3+3)*2=12, (1*2+2)*3=12 and (1+3)*3=12.
PROG
(C++) #include <iostream>
using namespace std; int f(int x, bool y) { if(x<0) return 0; if(x==1) return 1; if(y==0) return f(x-2, 1)+f(x-3, 1); if(y==1) { if(x%6==0) return f(x/2, 0)+f(x/3, 0); if(x%6==1||x%6==5) return 0; if(x%6==2||x%6==4) return f(x/2, 0); if(x%6==3) return f(x/3, 0); } } int n; int main() { cin>>n; cout<<1<<", "; for(int i=2; i<n; i++) cout<<f(i, 1)<<", "; cout<<f(n, 1); return 0; }
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Yifan Xie, Nov 01 2022
STATUS
approved