2 updated golf
source | link

R, 108108 98 bytes

-10 bytes by replacing the actual multiply sign with a plus sign. Please forgive me.

f=function(n){if(n<3)return(rep(1,n))else{v=f(n-1)};m=ifelse;if(n%%2,`+`,`*`);return`*`=`+`;return(c(1,m(v[3:n-2],v[2]*v[-1]),1))}

Try it online!Try it online!

Quite pleased with the general method (first time I've aliased a primitive) but I'm sure there's golfing to be done on it yet, especially with the awkward handling of cases where n<3 which leads to a lot of boilerplate.

R, 108 bytes

f=function(n){if(n<3)return(rep(1,n))else{v=f(n-1)};m=ifelse(n%%2,`+`,`*`);return(c(1,m(v[3:n-2],v[-1]),1))}

Try it online!

Quite pleased with the general method (first time I've aliased a primitive) but I'm sure there's golfing to be done on it yet, especially with the awkward handling of cases where n<3 which leads to a lot of boilerplate.

R, 108 98 bytes

-10 bytes by replacing the actual multiply sign with a plus sign. Please forgive me.

f=function(n){if(n<3)return(rep(1,n))else{v=f(n-1)};if(n%%2)`*`=`+`;return(c(1,v[3:n-2]*v[-1],1))}

Try it online!

Quite pleased with the general method (first time I've aliased a primitive) but I'm sure there's golfing to be done on it yet, especially with the awkward handling of cases where n<3 which leads to a lot of boilerplate.

1
source | link

R, 108 bytes

f=function(n){if(n<3)return(rep(1,n))else{v=f(n-1)};m=ifelse(n%%2,`+`,`*`);return(c(1,m(v[3:n-2],v[-1]),1))}

Try it online!

Quite pleased with the general method (first time I've aliased a primitive) but I'm sure there's golfing to be done on it yet, especially with the awkward handling of cases where n<3 which leads to a lot of boilerplate.