number of partitions bench mark

Richard Mathar mathar at strw.leidenuniv.nl
Wed May 14 10:19:49 CEST 2008


On Tue, May 13, 2008 at 12:12 PM, Jack Brennen <jb at brennen.net> wrote:

> Take the first 2*N integers and using each integer once and only
> once as either a numerator or a denominator, construct N fractions
> whose sum is an integer.
>
> How many unique solutions are there for each N?
>
> The sequence seems to begin:  1,1,7,21,190,...

Here are a couple of further values:
1, 1, 7, 21, 190, 1007, 6972,

I've got them with the following straightforward PARI/GP
implementation (taking about (2*n)!/n! iterations):

{ npairs(n) = loca(r,q,z); r=0;
  forvec(p=vector(n,i,[1,2*n]),
    q = eval( setminus( Set(vector(2*n,i,i)), Set(p) ) );
    for(j=1,n!,
      z=numtoperm(n,j);
      if(type( sum(j=1,#p,p[j]/q[z[j]]) )=="t_INT",r++);
    );
  ,2);
  r
}

Regards,
Max





More information about the SeqFan mailing list