#March 21, 2024, C17.txt Help:=proc(): print(`Pols(x,d), PolsE(x,d), IsIr(P), IsPr(P,x), WisW(d,x) `): 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: