File: filt_part

package info (click to toggle)
saml 970418-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,204 kB
  • ctags: 1,701
  • sloc: ansic: 17,182; sh: 2,583; yacc: 497; perl: 264; makefile: 250; python: 242
file content (6 lines) | stat: -rwxr-xr-x 249 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
#!/bin/sh
perl -ne '$|=1; chop; print "part[$_]\n";' | induce -q -m- -e \
'precious part(1);
part[n] = part[n,1] if n>0; part[0] = 1; part[n] = 0;
part[n,k] = 0 if n<k.(3.k-1)/2;
part[n,k] = part[n-k.(3.k-1)/2] + part[n-k.(3.k+1)/2] - part[n,k+1];'