login
a(1)=a(2)=1; a(n) = a(n-1)*a(n-2) + a(n-3) + a(n-4) + ... + a(1) for n>2.
1

%I #8 Jul 31 2015 21:29:54

%S 1,1,1,2,4,11,49,548,26872,14725925,395715057217,5827270253948278214,

%T 2305938581960065033611659323852,

%U 13437327306087560724405450621249967248150551970959

%N a(1)=a(2)=1; a(n) = a(n-1)*a(n-2) + a(n-3) + a(n-4) + ... + a(1) for n>2.

%C Form the product of the previous two terms and then add all other previous terms.

%t f[s_] := Block[{}, Append[s, s[[ -1]]s[[ -2]] + Plus @@ Drop[s, -2]]]; Nest[f, {1, 1}, 12] (* _Robert G. Wilson v_, May 26 2006 *)

%o #include <stdio.h> #include <inttypes.h> int main (void) { int64_t n1=1; int64_t n2=1; int i; int64_t sum=0,next; printf("%lld,%lld,",n1,n2); for (i=0;i<10;i++) { next=n1*n2+sum; sum+=n1; n1=n2; n2=next; printf("%lld,",n2); } }

%o (PARI) {m=14;print1(a=1,",",b=1,",");v=[];for(n=3,m,print1(k=a*b+sum(j=1,#v,v[j]),",");v=concat(v,a);a=b;b=k)} \\ _Klaus Brockhaus_

%Y Cf. A117030.

%K nonn

%O 1,4

%A Gabriel Finch (salsaman(AT)xs4all.nl), Apr 21 2006

%E a(13) and a(14) from _Klaus Brockhaus_, Apr 27 2006