# [seqfan] Re: Guess the Recurrence

Ron Hardin rhhardin at att.net
Sat Dec 4 14:15:18 CET 2010

```Those work neatly (bc)

\$ cat recur.b
define s(n,k) {
if(n==0&&k==0)return 1;
if(n==0||k==0)return 0;
return s(n-1,k-1)-(n-1)*s(n-1,k);
}

define recur(z) {
auto i;
print "a(n)=";
for(i=1; i<=z+1; i++) {
coef[i]=-s(z+2,z+2-i);
if(i>1&&coef[i]>=0)print "+";
print coef[i],"*a(n-",i,")";
}
print "\n";
}

for(z=0; z<8; z++) {
print "z=",z," ";
dummy=recur(z);
}
quit

\$ bc -q recur.b
z=0 a(n)=1*a(n-1)
z=1 a(n)=3*a(n-1)-2*a(n-2)
z=2 a(n)=6*a(n-1)-11*a(n-2)+6*a(n-3)
z=3 a(n)=10*a(n-1)-35*a(n-2)+50*a(n-3)-24*a(n-4)
z=4 a(n)=15*a(n-1)-85*a(n-2)+225*a(n-3)-274*a(n-4)+120*a(n-5)
z=5 a(n)=21*a(n-1)-175*a(n-2)+735*a(n-3)-1624*a(n-4)+1764*a(n-5)-720*a(n-6)
z=6
a(n)=28*a(n-1)-322*a(n-2)+1960*a(n-3)-6769*a(n-4)+13132*a(n-5)-13068*a(n-6)+5040*a(n-7)

z=7
a(n)=36*a(n-1)-546*a(n-2)+4536*a(n-3)-22449*a(n-4)+67284*a(n-5)-118124*a(n-6)+109584*a(n-7)-40320*a(n-8)

(The universal recurrence for rows and columns of T(n,k)=number of 0..z arrays
with every 2X2 subblock summing to 2z)

rhhardin at mindspring.com
rhhardin at att.net (either)

----- Original Message ----
> From: Douglas McNeil <mcneil at hku.hk>
> To: Sequence Fanatics Discussion list <seqfan at list.seqfan.eu>
> Sent: Fri, December 3, 2010 10:50:08 PM
> Subject: [seqfan] Re: Guess the Recurrence
>
> > Can we guess the middle ones?
>
> Aren't they clearly Stirling  numbers?  By "clearly" I don't mean I
> recognized them, I mean I entered  them into the OEIS and that's what
> popped up. ;^)
>
> sage: for i in  range(1, 7): print [stirling_number1(j,
> j-i)*(-1)**(i+1) for j in range(2,  8)]
> [1, 3, 6, 10, 15, 21]
> [0, -2, -11, -35, -85, -175]
> [0, 0, 6, 50,  225, 735]
> [0, 0, 0, -24, -274, -1624]
> [0, 0, 0, 0, 120, 1764]
> [0, 0, 0,  0, 0, -720]
>
>
> Doug
>
> --
> Department of Earth  Sciences
> University of Hong  Kong
>
>
> _______________________________________________
>
> Seqfan  Mailing list - http://list.seqfan.eu/
>

```