kdb - Pascal's triangle in k/q -
fibonacci nice:
f:|+\ 5 f\1 1
but haven't found similar expression pascal's triangle. best can get:
q){x+\\x#1}6 1 1 1 1 1 1 1 2 3 4 5 6 1 3 6 10 15 21 1 4 10 20 35 56 1 5 15 35 70 126 1 6 21 56 126 252 1 7 28 84 210 462
there's pretty nifty 1 on q idioms page
q)pt:{0+':x,0} q)4 pt\ 1 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Comments
Post a Comment