#Nuray Kutlu March 24 #OK TO POST #March 21, 2024, C17.txt MaxPer:=proc(d,x) local S,s,i,L,RES: RES:={}: S:=PolsE(x,d): for s in S do L:=PolToList(2,s,x,d): if FindPer(SR([1,0$(d-1)],L,10*(2^d -1)))= (2^d-1) then RES:=RES union s fi: od: end: #seq(evalb(MaxPer(d, x) = WisW(d, x)[4]), d = 3 .. 10): #false, false, false, false, false, false, false, false PolToList:=proc(q,P,x,d) local i: [seq(coeff(P,x, i) mod q, i=0..d)]:end: qPols:=proc(q,x,d) local S,s,i: option remember: if d=0 then RETURN({seq(i, i=0..q-1)}): fi: i:=0: S:=qPols(q,x,d-1): S union {seq(seq(s+i*x^d,s in S),i=0..q-1)}: end: qPolsE:=proc(q,x,d) local S, s, i: S:=qPols(q,x,d-1): {seq(seq(s+i*x^d, s in S), i=1..q-1)} end: qIsPr:=proc(q,P,x) local d,m,i: option remember: d:=degree(P,x): m:=2^d-1: for i from 1 to m-1 do: if rem(x^i,P,x) mod q = 1 then RETURN(false): fi: od: if rem(x^m, P, x) mod q <>1 then RETURN(FAIL): fi: true: end: qWisW:=proc(q,d,x) local S,s, Si, Sp, Sip, Sne: S:=qPolsE(q,x,d): Si:={}: Sp:={}: Sip:={}: Sne:={}: for s in S do if IsIr(s) and not qIsPr(s,x) then Si:=Si union {s}: elif not IsIr(s) and qIsPr(s,x) then Sp:=Sp union {s}: elif IsIr(s) and qIsPr(s,x) then Sip:=Sip union {s}: else Sne:=Sne union {s}: fi: od: [Sne,Si,Sp,Sip]: end: qMaxPer:=proc(q,d,x) local S,s,i,L,RES: RES:={}: S:=PolsE(x,d): for s in S do L:=PolToList(q,s,x,d): if FindPer(SR([1,0$(d-1)],L,10*(2^d -1)))= (2^d-1) then RES:=RES union s fi: od: end: #old code #C16.txt, March 18, 2024 Help16:=proc(): print(`SR(INI,L,n), IsPer1(L,t), FindPer(L) `):end: #SR(INI,L,n): inputs a 0-1 list of length L[nops(L)] # a list of increasing positive integers L, and outputs #the sequence of 0-1 generated by them of length n #outputs the list of length n generated by the recurrence #x[t]=x[t-L[1]]+...+x[t-L[nops(L)] SR:=proc(INI,L,n) local r,i,M,ng: r:=nops(L): if nops(INI)<>L[-1] then RETURN(FAIL): fi: if not (convert(INI,set)={0,1} or convert(INI,set)={1}) then RETURN(FAIL): fi: if not (type(L,list) and {seq(type(L[i],posint),i=1..nops(L))}={true} and sort(L)=L) then RETURN(FAIL): fi: if not type(n,posint) then RETURN(FAIL): fi: M:=INI: while(nops(M))1 then print(`Something bad happened, Cocks' aritcle is wrong!, or more likely (according to George)`): print(`we messed up`): RETURN(FAIL): fi: true: end: #WisW(d,x): inputs a pos. integer d and outputs the list of sets #of pol. of degree exactly d such that #(i) neither (ii) Irred. but not Primitive (iii) Primitive but not irreducible (iv) both WisW:=proc(d,x) local S,s, Si, Sp, Sip, Sne: #Si:=set of pol. of degree d (mod 2) that are irreducible but NOT primitive #Sp:=set of pol. of degree d (mod 2) that are NOT irreducible but primitive #Sip:=set of pol. of degree d (mod 2) that are BOTH irreducible and primitive #Sne= neither S:=PolsE(x,d): Si:={}: Sp:={}: Sip:={}: Sne:={}: for s in S do if IsIr(s) and not IsPr(s,x) then Si:=Si union {s}: elif not IsIr(s) and IsPr(s,x) then Sp:=Sp union {s}: elif IsIr(s) and IsPr(s,x) then Sip:=Sip union {s}: else Sne:=Sne union {s}: fi: od: [Sne,Si,Sp,Sip]: end: