OFFSET
1,1
COMMENTS
The clock has 3 bars with lengths 5, 11, 11. So the minimal number of balls is (5+11+11)+1=27. Use clock(0) PARI script to get the permutation.
LINKS
PROG
(PARI) clock(n) = {vb1 = []; vb2 = []; vb3 = []; nb1 = 5; nb2 = 12; nb3 = 12; nbmin = (nb1-1) + (nb2-1) + (nb3-1)+1; vbn = vector(nbmin+n, x, x); nbt = nb1*nb2*nb3; for (i=1, nbt, ib = vbn[1]; vbn = vector(length(vbn)-1, x, vbn[x+1]); vb1 = concat(vb1, ib); if (length(vb1) == nb1, vb2 = concat(vb2, ib); forstep(j=nb1-1, 1, -1, vbn = concat(vbn, vb1[j]); ); vb1 = []; if (length(vb2) == nb2, vb3 = concat(vb3, ib); forstep(j=nb2-1, 1, -1, vbn = concat(vbn, vb2[j]); ); vb2 = []; if (length(vb3) == nb3, vbn = concat(vbn, ib); forstep(j=nb3-1, 1, -1, vbn = concat(vbn, vb3[j]); ); vb3 = []; ); ); ); /* write("clock.log", "vb1=", vb1); write("clock.log", "vb2=", vb2); write("clock.log", "vb3=", vb3); write("clock.log", "vbN=", vbn); write("clock.log", "-----------"); */ ); return (vbn); }
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
Michel Marcus, Jan 21 2013
STATUS
approved