########################################################################## ## ZeckFibBijections: Save this file as ZeckFibBijections to use it, # ## stay in the same directory, get into Maple # ## (by typing: maple ) # ## and then type: read ZeckFibBijections: # ## Then follow the instructions given there # ## # ## Written by Philip Matchett Wood, Rutgers University , # ## matchett@math.rutgers.edu. # ########################################################################## print(`First Written: Mar. 22, 2006: tested for Maple 10 `): print(`Version of Mar. 22, 2006: `): print(): print(`This is ZeckFibBijections, A Maple package`): print(`accompanying the article: `): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(` by Philip Matchett Wood`): print(`Available from:`): print(`http://www.math.rutgers.edu/~matchett/Publications/`): print( ): print(`The most current version of this program is available on WWW at:`): print(` http://www.math.rutgers.edu/~matchett/Publications/ZeckFibBijections.`): print(`Please report all bugs to: matchett at math dot rutgers dot edu .`): print(): print(`For general help, and a list of the MAIN functions,`): print(` type "Help();". For specific help type "Help(procedure_name);" `): print(): Help:=proc() if args=NULL then print(` ZeckFibBijections: A Maple package implementing the`): print(`bijection described in `): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`The MAIN procedures are`): print(`F, MtimesF,`): print(`phi5, phi6, ..., phi12,`): print(`Chechphi5, Checkphi6, ..., Checkphi12 , `): print(`phi5inv, Chechphi5phi5inv, Checkphi5invphi5, `): print(`phi5prime, Checkphi5prime`): print(`For help with a specific procedure, type Help(Procedure);`): print(`For example, for help with Checkphi5, type: Help(Checkphi5);`): elif nargs=1 and args[1]=Checkphi5 then print(`Checkphi5(k): For an integer k, checks that`): print(` phi5 is a bijection from MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi5 gives a bijective proof of the identity`): print(`$5f_n= f_{n+3} + f_{n-1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi5(10);`): elif nargs=1 and args[1]=Checkphi5prime then print(`Checkphi5prime(k): For an integer k, checks that`): print(` phi5prime is a bijection from MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi5prime gives an alternate bijective proof of the identity`): print(`$5f_n= f_{n+3} + f_{n-1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi5prime(10);`): elif nargs=1 and args[1]=Checkphi6 then print(`Checkphi6(k): For an integer k, checks that`): print(` phi6 is a bijection from MtimesF(6,n) to F(n+3) union F(n+1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi6 gives a bijective proof of the identity`): print(`$6f_n= f_{n+3} + f_{n+1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi6(10);`): elif nargs=1 and args[1]=Checkphi7 then print(`Checkphi7(k): For an integer k, checks that`): print(` phi7 is a bijection from MtimesF(7,n) to F(n+4) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi7 gives a bijective proof of the identity`): print(`$7f_n= f_{n+4} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi7(10);`): elif nargs=1 and args[1]=Checkphi8 then print(`Checkphi8(k): For an integer k, checks that`): print(` phi8 is a bijection from MtimesF(8,n) to F(n+4) union F(n) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi8 gives a bijective proof of the identity`): print(`$8f_n= f_{n+4} + f_n + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi8(10);`): elif nargs=1 and args[1]=Checkphi9 then print(`Checkphi9(k): For an integer k, checks that`): print(` phi9 is a bijection from MtimesF(9,n) to F(n+4) union F(n+1) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi9 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+1} + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi9(10);`): elif nargs=1 and args[1]=Checkphi10 then print(`Checkphi10(k): For an integer k, checks that`): print(` phi10 is a bijection from MtimesF(10,n) to F(n+4) union F(n+2) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi10 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+2} + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi10(10);`): elif nargs=1 and args[1]=Checkphi11 then print(`Checkphi11(k): For an integer k, checks that`): print(` phi11 is a bijection from MtimesF(11,n) to F(n+4) union F(n+2) union F(n) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi11 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+2} + f_n + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi11(10);`): elif nargs=1 and args[1]=Checkphi12 then print(`Checkphi12(k): For an integer k, checks that`): print(` phi12 is a bijection from MtimesF(12,n) to F(n+5) union F(n-1) union F(n-3) union F(n-6),`): print(`for n = 6,7,8...,k.`): print(`Thus phi12 gives a bijective proof of the identity`): print(`$9f_n= f_{n+5} + f_{n-1} + f_{n-3} + f_{n-6}$`): print(`for n = 6,7,8,...,k.`): print(`For example, try: Checkphi12(13);`): elif nargs=1 and args[1]=phi5 then print(`phi5(n,X): For an integer n > 3, phi5 is a mapping from `): print(`MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4)`): print(`For example, try: phi5(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi5prime then print(`phi5prime(n,X): For an integer n > 3, phi5prime is a mapping from `): print(`MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4)`): print(`For example, try: phi5prime(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi5inv then print(`phi5inv(n,Y): For an integer n > 3, phi5inv is a mapping from `): print(`F(n+3) union F(n-1) union F(n-4) to MtimesF(5,n)`): print(`For example, try: phi5inv(4,[2,1,2,1,1]]);`): elif nargs=1 and args[1]=phi6 then print(` phi6 is a bijection from MtimesF(6,n) to F(n+3) union F(n+1) union F(n-4),`): print(`For example, try: phi6(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi7 then print(` phi7 is a bijection from MtimesF(7,n) to F(n+4) union F(n-4),`): print(`For example, try: phi7(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi8 then print(` phi8 is a bijection from MtimesF(8,n) to F(n+4) union F(n) union F(n-4),`): print(`For example, try: phi8(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi9 then print(` phi9 is a bijection from MtimesF(9,n) to F(n+4) union F(n+1) union F(n-2) union F(n-4),`): print(`For example, try: phi9(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi10 then print(` phi10 is a bijection from MtimesF(10,n) to F(n+4) union F(n+2) union F(n-2) union F(n-4),`): print(`For example, try: phi10(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi11 then print(` phi11 is a bijection from MtimesF(11,n) to F(n+4) union F(n+2) union F(n) union F(n-2) union F(n-4),`): print(`For example, try: phi11(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi12 then print(` phi12 is a bijection from MtimesF(12,n) to F(n+5) union F(n-1) union F(n-3) union F(n-6),`): print(`For example, try: phi12(6,[2,[2,2,1,1]]);`): elif nargs=1 and args[1]=Checkphi5phi5inv then print(`Checkphi5phi5inv(n): For an integer n > 3, checks that`): print(` phi5 composed with phi5inv is the identity mapping `): print(`For example, try: Checkphi5phi5inv(7);`): elif nargs=1 and args[1]=Checkphi5invphi5 then print(`Checkphi5invphi5(n): For an integer n > 3, checks that`): print(` phi5inv composed with phi5 is the identity mapping `): print(`For example, try: Checkphi5invphi5(7);`): elif nargs=1 and args[1]=MtimesF then print(`MtimesF(m,n): For integers m>=0 and n>=0, returns the set`): print(`$\\{1,2,...,m\\} \\times F(n)$`): print(`The cardinality of MtimesF(m,n) is equal to`): print(`m times the n-th Fibonacci number.`): print(`For example, try: MtimesF(2,3);`): elif nargs=1 and args[1]=F then print(`F(n): For an integer n >= 0, returns the set of `): print(`ordered lists of 1's and 2's, each of which sums to n`): print(`The cardinality of F(n) is the n-th Fibonacci number.`): print(`For example, try: F(3);`): else print(`There is no such thing as`, args): fi: end: Hlp:=proc():print(`F(n), MtimesF(m,n), `): print(`phi5(n,X), phi6(n,X), ..., phi12(n,X)`): print(`Checkphi5(n), Checkphi6(n), ..., Checkphi12(n)`): print(`phi5inv(n,Y), Checkphi5phi5inv(n), Checkphi5invpih5(n) `): print(`phi5prime(n,X), Checkphi5prime(n)`): end: ####################### F(n) and MtimesF(m,n) --------------- #F(n): builds the set F(n) of fibonnacci numbers. F:=proc(n) local i: option remember: if n = 0 then return {[]}: elif n=1 then return {[1]}: fi: return {seq([1,op(F(n-1)[i])], i=1..nops(F(n-1))), seq([2,op(F(n-2)[i])],i=1..nops(F(n-2)))}: end: MtimesF:=proc(m,n) local i,j,X,mFn: mFn:={}: for X in F(n) do mFn:=mFn union {seq([i,X],i=1..m)}: od: mFn: end: ####################### phi5 -------------------------- phi5:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,op(X)]: elif i=2 then return [1,2,op(X)]: elif i=3 then return [2,1,op(X)]: elif i=4 then if [op(1..1,X)]=[1] then return [2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=5 then if [op(1..1,X)]=[1] then return [op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi5:=proc(m) local n,P,Image: if m < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to m do Image:={}: for P in MtimesF(5,n) do #print(n,P,`----->`,phi5(n,P)); Image:=Image union {phi5(n,P)}: od: if (not Image = F(n+3) union F(n-1) union F(n-4)) or (not nops(MtimesF(5,n))= nops(Image)) then print(`phi5 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi5 IS a bijection for n =`): seq(n,n=4..m): end: phi5inv:=proc(n,Y): if member(Y,F(n-4)) then return [4,[2,2,op(Y)]]: elif member(Y,F(n-1)) then return [5,[1,op(Y)]]: elif member(Y,F(n+3)) then if [op(1..3,Y)] = [1,1,1] then return [1,[op(4..nops(Y),Y)]]: elif [op(1..4,Y)] = [1,1,2,1] then return [5,[2,op(5..nops(Y),Y)]]: elif [op(1..4,Y)] = [1,1,2,2] then return [4,[2,1,op(5..nops(Y),Y)]]: elif [op(1..2,Y)] = [1,2] then return [2,[op(3..nops(Y),Y)]]: elif [op(1..2,Y)] = [2,1] then return [3,[op(3..nops(Y),Y)]]: elif [op(1..2,Y)] = [2,2] then return [4,[1,op(3..nops(Y),Y)]]: fi: else return FAIL: fi: end: Checkphi5phi5inv:=proc(n) local Y,S,isbad: isbad:=false: if n < 4 then print(`not valid for n<4`): return: fi: S:=F(n+3) union F(n-1) union F(n-4): for Y in S do if not phi5(n,phi5inv(n,Y)) = Y then print(Y, phi5inv(n,Y), phi5(n,phi5inv(n,Y))): print(`phi5 of phi5inv is NOT the identity for Y=`,Y): isbad:=true: fi: od: if isbad = true then return FAIL: else print(`phi5 of phi5inv IS the identity for n=`,n): fi: end: Checkphi5invphi5:=proc(n) local Y,S,isbad: isbad:=false: if n < 4 then print(`not valid for n<4`): return: fi: S:=MtimesF(5,n): for Y in S do if not phi5inv(n,phi5(n,Y)) = Y then print(Y, phi5(n,Y), phi5inv(n,phi5(n,Y))): print(`phi5inv of phi5 is NOT the identity for Y=`,Y): isbad:=true: fi: od: if isbad = true then return FAIL: else print(`phi5inv of phi5 IS the identity for n=`,n): fi: end: ####################### phi5prime --------------------- phi5prime:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,op(X)]: elif i=2 then return [1,2,op(X)]: elif i=3 then return [2,1,op(X)]: elif i=4 then if [op(1..1,X)]=[1] then return [1,1,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=5 then if [op(1..1,X)]=[1] then return [2,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi5prime:=proc(m) local n,P,Image: if m < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to m do Image:={}: for P in MtimesF(5,n) do #print(n,P,`----->`,phi5prime(n,P)); Image:=Image union {phi5prime(n,P)}: od: if (not Image = F(n+3) union F(n-1) union F(n-4)) or (not nops(MtimesF(5,n))= nops(Image)) then print(`phi5prime is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi5prime IS a bijection for n =`): seq(n,n=4..m): end: ####################### phi6 -------------------------- phi6:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,op(X)]: elif i=2 then return [1,1,1,op(X)]: elif i=3 then return [1,2,op(X)]: elif i=4 then return [2,1,op(X)]: elif i=5 then if [op(1..1,X)]=[1] then return [2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=6 then if [op(1..1,X)]=[1] then return [2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi6:=proc(n) local i,P,Image: if n < 4 then print(`not applicable when n < 4`): return: fi: for i from 4 to n do Image:={}: for P in MtimesF(6,i) do #print(i,P,`----->`,phi6(i,P)); Image:=Image union {phi6(i,P)}: od: if (not Image = F(i+3) union F(i+1) union F(i-4)) or (not nops(MtimesF(6,i))= nops(Image)) then print(`phi6 is NOT a bijection for n=`,i): return FAIL: fi: od: print(`phi6 IS a bijection for n =`): seq(i,i=4..n): end: ####################### phi7 -------------------------- phi7:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,op(X)]: elif i=2 then return [1,1,2,op(X)]: elif i=3 then return [1,2,1,op(X)]: elif i=4 then return [2,1,1,op(X)]: elif i=5 then return [2,2,op(X)]: elif i=6 then if [op(1..1,X)]=[1] then return [1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,1,1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=7 then if [op(1..1,X)]=[1] then return [2,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,1,1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi7:=proc(k) local n,P,Image: if k < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to k do Image:={}: for P in MtimesF(7,n) do #print(n,P,`----->`,phi7(n,P)); Image:=Image union {phi7(n,P)}: od: if (not Image = F(n+4) union F(n-4)) or (not nops(MtimesF(7,n))= nops(Image)) then print(`phi7 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi7 IS a bijection for n =`): seq(n,n=4..k): end: ####################### phi8 -------------------------- phi8:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,op(X)]: elif i=2 then return [1,1,2,op(X)]: elif i=3 then return [1,2,1,op(X)]: elif i=4 then return [2,1,1,op(X)]: elif i=5 then return [2,2,op(X)]: elif i=6 then return X: elif i=7 then if [op(1..1,X)]=[1] then return [1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,1,1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=8 then if [op(1..1,X)]=[1] then return [2,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,1,1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi8:=proc(k) local n,P,Image: if k < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to k do Image:={}: for P in MtimesF(8,n) do #print(n,P,`----->`,phi8(n,P)); Image:=Image union {phi8(n,P)}: od: if (not Image = F(n+4) union F(n) union F(n-4)) or (not nops(MtimesF(8,n))= nops(Image)) then print(`phi8 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi8 IS a bijection for n =`): seq(n,n=4..k): end: ####################### phi9 -------------------------- phi9:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,op(X)]: elif i=2 then return [1,1,2,op(X)]: elif i=3 then return [1,2,1,op(X)]: elif i=4 then return [2,1,1,op(X)]: elif i=5 then return [2,2,op(X)]: elif i=6 then return [1,op(X)]: elif i=7 then if [op(1..1,X)]=[1] then return [1,1,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [op(2..nops(X),X)]: else return FAIL: fi: elif i=8 then if [op(1..1,X)]=[1] then return [1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=9 then if [op(1..1,X)]=[1] then return [2,1,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [2,1,1,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [2,1,2,op(3..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi9:=proc(k) local n,P,Image: if k < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to k do Image:={}: for P in MtimesF(9,n) do #print(n,P,`----->`,phi9(n,P)); Image:=Image union {phi9(n,P)}: od: if (not Image = F(n+4) union F(n+1) union F(n-2) union F(n-4)) or (not nops(MtimesF(9,n))= nops(Image)) then print(`phi9 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi9 IS a bijection for n =`): seq(n,n=4..k): end: ####################### phi10 -------------------------- phi10:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,op(X)]: elif i=2 then return [1,1,2,op(X)]: elif i=3 then return [1,2,1,op(X)]: elif i=4 then return [2,1,1,op(X)]: elif i=5 then return [2,2,op(X)]: elif i=6 then return [1,1,op(X)]: elif i=7 then return [2,op(X)]: elif i=8 then if [op(1..1,X)]=[1] then return [1,1,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [op(2..nops(X),X)]: else return FAIL: fi: elif i=9 then if [op(1..1,X)]=[1] then return [1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=10 then if [op(1..1,X)]=[1] then return [2,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi10:=proc(k) local n,P,Image: if k < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to k do Image:={}: for P in MtimesF(10,n) do #print(n,P,`----->`,phi10(n,P)); Image:=Image union {phi10(n,P)}: od: if (not Image = F(n+4) union F(n+2) union F(n-2) union F(n-4)) or (not nops(MtimesF(10,n))= nops(Image)) then print(`phi10 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi10 IS a bijection for n =`): seq(n,n=4..k): end: ####################### phi11 -------------------------- phi11:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,op(X)]: elif i=2 then return [1,1,2,op(X)]: elif i=3 then return [1,2,1,op(X)]: elif i=4 then return [2,1,1,op(X)]: elif i=5 then return [2,2,op(X)]: elif i=6 then return [1,1,op(X)]: elif i=7 then return [2,op(X)]: elif i=8 then return X: elif i=9 then if [op(1..1,X)]=[1] then return [1,1,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [op(2..nops(X),X)]: else return FAIL: fi: elif i=10 then if [op(1..1,X)]=[1] then return [1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [op(3..nops(X),X)]: else return FAIL: fi: elif i=11 then if [op(1..1,X)]=[1] then return [2,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,2,1,op(2..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi11:=proc(k) local n,P,Image: if k < 4 then print(`not applicable when n < 4`): return: fi: for n from 4 to k do Image:={}: for P in MtimesF(11,n) do #print(n,P,`----->`,phi11(n,P)); Image:=Image union {phi11(n,P)}: od: if (not Image = F(n+4) union F(n+2) union F(n) union F(n-2) union F(n-4)) or (not nops(MtimesF(11,n))= nops(Image)) then print(`phi11 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi11 IS a bijection for n =`): seq(n,n=4..k): end: ####################### phi12 -------------------------- phi12:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,1,op(X)]: elif i=2 then return [1,1,1,2,op(X)]: elif i=3 then return [1,1,2,1,op(X)]: elif i=4 then return [1,2,1,1,op(X)]: elif i=5 then return [2,1,1,1,op(X)]: elif i=6 then return [1,2,2,op(X)]: elif i=7 then return [2,1,2,op(X)]: elif i=8 then return [2,2,1,op(X)]: elif i=9 then if [op(1..1,X)]=[1] then return [1,1,1,1,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [op(3..nops(X),X)]: elif [op(1..3,X)]=[2,2,1] then return [2,2,2,2,2,op(4..nops(X),X)]: elif [op(1..3,X)]=[2,2,2] then return [op(4..nops(X),X)]: else return FAIL: fi: elif i=10 then if [op(1..1,X)]=[1] then return [op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [2,2,2,1,op(2..nops(X),X)]: else return FAIL: fi: elif i=11 then if [op(1..1,X)]=[1] then return [2,1,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,1,2,2,1,op(2..nops(X),X)]: else return FAIL: fi: elif i=12 then if [op(1..1,X)]=[1] then return [1,2,1,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [1,1,2,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [2,2,2,2,1,op(3..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: Checkphi12:=proc(k) local n,P,Image: if k < 6 then print(`not applicable when n < 6`): return: fi: for n from 6 to k do Image:={}: for P in MtimesF(12,n) do #print(n,P,`----->`,phi12(n,P)); Image:=Image union {phi12(n,P)}: od: if (not Image = F(n+5) union F(n-1) union F(n-3) union F(n-6)) or (not nops(MtimesF(12,n))= nops(Image)) then print(`phi12 is NOT a bijection for n=`,n): return FAIL: fi: od: print(`phi12 IS a bijection for n =`): seq(n,n=6..k): end: #EOF