Newest version.This is a modification of the file posted on the publisher's web site. I have tried to improve readability and to replace references to the deprecated linalg package by references to the current LinearAlgebra package. I have used "shift-enter" to indent the code.Please email me if there are errors.Since the following worksheet uses commands that are not loaded when Maple is loaded, we need to load the following specialized packages which define extra Maple commands. If the user does not click on this section of the worksheet before using Maple commands that come below it, Maple will merely parrot back commands that it does not know the meaning of and and not do them.
One way to get Maple to read all commands in a worksheet is to click on the !!! Tool. When one saves a worksheet and re-opens it in Maple, the fact that the user can see commands in the worksheet does not mean that Maple will also see them. Maple only "sees" a command when it is entered into memory by clicking on a line or when the !!! Tool is pressed.If you have two worksheets open at the same time, the fact that you have clicked on a command in one of them does not obviate your need to click on the command in the second worksheet. The two worksheets are treated as separate Maple processes, and know nothing of each other. (Tools, Options ..., General, New engine for each document.)The restart command wipes all memory. After having executed that command, Maple is completely restarted, with no memory of commands that had been executed previously. If Maple starts to interpret things in a very strange manner, it is often the case that it is remembering changes made out of order. The !!! Tool will fix that if the worksheet begins with a restart;restart:
with(LinearAlgebra):
with(numtheory):
with(plots):
A table is an array. In this particular case, the number entries in the table are indexed not by integers, but by strings. The ""-th entry of the table is the number 0. The "a"-th entry in the table is the number 1, etc.Note that the numb table is not a part of standard Maple. You must click on it to enter the table into Maple's memory, or Maple will not know what you are talking about when you get to the shift command below.Even if you have clicked on the numb definition in this worksheet, you will not be able to refer to numb in a different worksheet without copying and pasting the definitions into that worksheet. numb:=table([""=0,"a"=1,"b"=2,"c"=3,"d"=4,"e"=5,"f"=6,"g"=7,"h"=8,"i"=9,"j"=10,"k"=11,"l"=12,"m"=13,"n"=14,"o"=15,"p"=16,"q"=17,"r"=18,"s"=19,"t"=20,"u"=21,"v"=22,"w"=23,"x"=24,"y"=25,"z"=26]):This is the inverse table of the relation defined above, ie., the ordered pairs are reversed. The 0-th entry in the table is the empty string "", the 1st entry in the table is the "a" string, etc.alph:=table([0="",1="a",2="b",3="c",4="d",5="e",6="f",7="g",8="h",9="i",10="j",11="k",12="l",13="m",14="n",15="o",16="p",17="q",18="r",19="s",20="t",21="u",22="v",23="w",24="x",25="y",26="z"]):
This procedure does a Caesar cipher on a string: a simple translation. Its functionality is subsumed in that of affinecrypt( ,1,n).
Note that the code has been commented. Each line that begins with # is ignored at execution time, but the reader can go back and follow what the various steps are designed to do by reading the # comments put in by the programmer.When one is writing a Maple procedure, it is not always easy to see if there are mistakes. The option trace command shows the respective outputs command by command, so one can see what the machine is doing. (The machine always does what you say, but not necessarily what you meant to say.)If you remove the # in the option trace command below, you will be able to follow each step by hand to see what is happening.It is, of course, desirable once the program has been completed and tested to reinsert the # so that intermediate results are not printed.Note that I have broken the book's complicated commands into simple ones. It is bad Karma to put one Maple command inside another, since one has no idea what the inner command produced. By using the "last output" operator, %, we can see each and every step as it is done.
The variable contained in the line with "local" are only recognized within the procedure. If a variable is labeled i outside the procedure, changing the value of i inside the procedure will have no effect on the value of the variable i occurring outside the procedure. In geek speak, the scope is local. If you want to have a variable that is changed within a procedure also change the value outside the procedure, there is a corresponding command called "global."shift:=proc(txt,n)
local i,z;
# remove the # on only the following line to trace the internal outputs
# option trace;
# Create a NULL string on which to add letters.
z:=NULL;
# While i is less than or equal to the number of letters in the string, do
for i from 1 while i<=length(txt) do
# Grab the substring (letter) in the i-th place of txt.
substring(txt,i);
# Use the numb table to convert the letter to a number between 1 and 26.
numb[%];
# Arithmetic mod 26 uses numbers between 0 and 25, not 1 and 26
%-1;
# Now cyclically shift the letter mod 26.
%+n mod 26;
# Take the numbers between 0 and 25 and again make them between 1 and 26, as people count letters.
%+1;
# Use the alph table to convert the shifted number back to a letter.
alph[%];
# Add the new letter on the right side of the shifted string.
z:=cat(z,%);
end do;
return(z);
# To check that syntax is correct, change end: to end; Blue output means "syntax is OK."
end:
Example:shift("cat",3);
This procedure gives all possible Caesar ciphers of a given text string. Since none of the shifts of the given string are "dictionary" words, one can determine the amount of the shift by an exhaustive search. The correct shift is the shift that produces readable text.There may well be short words that will form dictionary words under two different shifts, although I do not have an example. However, as the strings get longer, it becomes increasingly less likely that different shifts of the same string will both make sense. (See the concept of unicity distance, p. 342, which is based on the idea that spoken languages are stationary stochastic processes, with an information content called the entropy per letter.) In the example below, shifting "fdw" when shifted by 23 produces a meaningful text, so the original string has been shifted by 26 - 23 = 3.allshifts:= proc(txt)
local i;
for i from 0 while i<26 do
shift(txt,26+i);
print(%);
end do;
end:
Example 1, p. 498: show all possible shifts to see which shift cipher was used.allshifts("kddkmu");As an exercise, use the comments that I inserted in the shift procedure to insert additional comments to explain to yourself what each step does. When you come back to modify the code in two weeks, you will be happy that you put in comments, for otherwise you will not recall what is happening.affinecrypt:= proc(txt,m,n)
local i,z;
option trace;
z:=NULL;
for i from 1 while i<=length(txt) do
substring(txt,i);
numb[%];
%-1;
%*m+n mod 26;
%+1;
alph[%];
z:=cat(z,%);
end do;
return(z);
end;
Example 2, p. 499: affine encoding using map x -> 7x + 8affinecrypt("cleopatra",7,8);vigenere:= proc(txt,v)
local i,z,one,two;
# option trace;
z:=NULL;
for i from 1 while i<=length(txt) do
# nops(v) is the number of entries in the list v
# v[i] is the i-th digit in the list.
# We want to convert from counting numbers 1..nops(v) to congruence classes 0..nops(v)-1.
# Then mod by the length of the list
(i-1) mod nops(v);
%+1;
# one is the amount by which the letter is shifted left (minus)
one:=v[%];
#one:=v[(i-1) mod nops(v) + 1];
substring(txt,i);
two:=numb[%];
two+one mod 26;
# the result of the next line is the shifted version of the original letter
alph[%];
z:=cat(z,%);
#z:=cat(z,alph[two+one mod 26]);
end do;
return(z);
end:
Example 4, p. 501: vvhq:= "vvhqwvvrhmusgjgthkihtssejchlsfcbgvwcrlryqtfsvgahwkcuhwauglqhnslrljshbl\134
tspisprdxljsveeghlqwkasskuwepwqtwvspgoelkcqyfnsvwljsniqkgnrgybwlwgoviokhkazkqk\134
xzgyhcecmeiujoqkwfwvefqhkijrclrlkbienqfrjljsdhgrhlsfqtwlauqrhwdmwlgusgikkflryv\134
cwvspgpmlkassjvoqxeggveyggzmljcxxljsvpaivwikvrdrygfrjljslveggveyggeiapuuisfpbt\134
gnwwmuczrvtwglrwugumnczvile":
vigenere(vvhq,-[2,14,3,4,18]);choose:=proc(txt,m,n)
local i,z;
z:=NULL;
for i from n by m while i<=length(txt) do
substring(txt,i);
z:=cat(z,%);
end do;
return(z);
end:
Example 4, p. 501.str:=choose(vvhq,5,1);frequency:=proc(txt)
local i,j,k,v,z;
z:=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
for i from 1 while i<=length(txt) do
substring(txt,i);
j:=numb[%];
z:=subsop(j=z[j]+1,z);
end do;
return(z);
end:
Example 4, p. 501:
frequency(str);vigvec:= proc(txt,m,n)
local w,z,i;
z:=choose(txt,m,n);
# Multiplying by a floating point decimal converts all subsequent outputs to floats, too.
# Note that you probably did not want to see a vulgar fraction version of the frequency.
w:=frequency(z)/length(z)*1.;
return(w);
end;
Example 4, p. 501:
lst:=vigvec(vvhq,5,1);# alphabet frequency table
alfreq:=[.082,.015,.028,.043,.127,.022,.020,.061,.070,.002,.008,.040,.024,.067,.075,.019,.001,.060,.063,.091,.028,.010,.023,.001,.020,.001];
# cross correlations of frequency distribution v with alphabet frequency distribution
corr:=proc(v)
local i,j,w,z,s;
# option trace;
interface(rtablesize=infinity);
Matrix(1,26,alfreq);
# strip square backets from v, concatenate sequence with itself
op(v),op(v);
# turn back into a list and convert list to a column Matrix
w:=Matrix(<<[%]>>);
z:=NULL;
for j from 1 to 26 do
s:=0;
for i from 1 to 26 do
s:=s+alfreq[i]*w[i+j-1,1];
od;
z:=z,%;
od;
return([z]);
end:
Example 4, p. 501:corr(lst);coinc:=proc(txt,s)
local i,w,z;
z:=0;
for i from 1 while i<=length(txt)-s do
if substring(txt,i)=substring(txt,i+s) then
z:=z+1;
else
z:=z;
fi;
end do;
return(z);
end:
Example 4, p. 500: count coincidences if we shift the string by 3
coinc(vvhq,3);lfsr:=proc(c,k,n)
local i,j,z,m;
z:=op(k);
for i from 1 while i<=(n-nops(c)) do
m:=[z];
# The sum command already has a loop built in.
z:=z,sum(m[j+i-1]*c[j],j=1..nops(c)) mod 2;
od;
[z];
end:
Example 6, p. 503: The initial values are [0,1,0,0,0], and the coefficients are [1,0,1,0,0]. We produce a Maple list of the first 50 outputs.lfsr([1,0,1,0,0],[0,1,0,0,0],50);lfsrlength:=proc(v,n)
local w,z,i,j,k;
for k from 1 while k<=n do
#w:=array(1..k,1..k);
w:=Matrix(k,k);
for i from 1 while i<=k do
for j from 1 while j<=k do
w[i,j]:=v[i+j-1];
end do;
end do;
print([k,Determinant(w) mod 2]);
end do;
end:
Example 8, p. 505: Find the length of the recurrence.lfsrlength([1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1],8);lfsrsolve:=proc(v,n)
local w1,w,i,j;
# w1 is a column matrix
w1:=Matrix(<v[(n+1)..2*n]>);
# w is a square matrix, with a loop to shift each row one to the left
w:=Matrix(n,n);
for i from 1 while i<=n do
for j from 1 while j<=n do
w[i,j]:=v[i+j-1];
end do;
end do;
1/w.w1 mod 2;
# Transpose interchanges rows and columns of a matrix
Transpose(%);
# Take the elements in the row matrix from the product and change the form from
# matrix to list.
convert(%,list);
end:
Example 8, p. 505:lfsrsolve([1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1],5);text2num:=proc(txt)
local i,z;
z:=0;
for i from 1 while i<=length(txt) do
substring(txt,i);
numb[%];
z:=100*z+%;
end do;
return(z);
end:
Example 2, p. 510.
mouthful:=text2num("hellohowareyou");num2text:=proc(n)
local i,w,z;
z:=NULL;
w:=n;
for i from 1 while 100^(i-1)<n do
alph[w mod 100];
z:=cat(%,z);
w:=floor(w/100);
end do;
return(z);
end:
And the reverse: Example 2, p. 510.num2text(mouthful);cards:=[200514,10010311,1721050514,11091407,10305]:
with(combinat,randperm):
khide:=proc();
2*rand()+101;
end:
shuffle:=proc(k)
local z;
z:=randperm({cards[1]&^k,cards[2]&^k,cards[3]&^k,cards[4]&^k,cards[5]&^k}mod 24691313099);
return(z);
end:
reveal:=proc(c)
local k1,z;
k1:= k&^(-1) mod 24691313098;
z:=[c[1]&^k1,c[2]&^k1,c[3]&^k1,c[4]&^k1,c[5]&^k1] mod 24691313099;
z:=[num2text(z[1]),num2text(z[2]),num2text(z[3]),num2text(z[4]),num2text(z[5])];
return(z);
end:
advise:=proc(v)
local i,w,z;
w:=1;
for i from 1 while w=1 do
w:=v[i]&^((24691313099-1)/2) mod 24691313099;
end do;
return(i-1);
end:
Elliptic curve addition.addell:=proc(p1,p2,a,b,n)
local z,z1,m,x3,y3,p3;
# option trace;
# On p. 352, they use b and c, rather than a and b: y^2=x^3+bx+c,
# Stay alert.
# p3 is the sum of the two points.
# z being zero means that the sum has not yet been found.
z:=0;
# If z1 is other than 1, then we have a strange case and we return the factor
# rather than the answer.
# Assume that we have a normal answer and change the flag if not.
z1:=1;
# If the first term is the point at infinity, then the sum is the second point.
if p1=["infinity","infinity"] then
# Set the sum.
p3:=p2;
# Turn on flag saying sum is already done.
z:=1;
end if;
# Skip if the sum has already been computed, so that z=1.
# Otherwise, see if our sum is the case considered below.
if z=1 then
NULL;
else
# If the second term is the point at infinity, set sum to be first term.
if p2=["infinity","infinity"] then
p3:=p1;
z:=1;
end if;
end if;
# If the sum has not yet been computed, see if the case below applies.
if z=1 then
NULL;
else
# If the x coordinates are the same and the y-coordinate is zero
if p1[1]=p2[1] and p1[2]=0 then
p3:=["infinity","infinity"];
z:=1;
end if;
end if;
# x-coordinates the same, but y-coordinates different implies vertical slope.
if z=1 then
NULL
else
if p1[1]=p2[1] and p1[2]<>p2[2] then
p3:=["infinity","infinity"];
z:=1;
end if;
end if;
# Set the error flag z1 if we fail to have relative primeness.
if z=1 then
NULL;
else if p1=p2 and gcd(p1[2],n)<>1 and gcd(p1[2],n)<>n then
z1:=gcd(p1[2],n);
z:=1 else end if;
end if;
if z=1 then
NULL;
else
# If the points are equal, then we are in the second case of the braces on p. 352.
if p1=p2 then
# First compute the slope: (3x^2+b)/(2y)
m:=(3*p1[1]^2+a)/(2*p1[2]) mod n;
z:=1;
# Using the value of the slope, compute the sum.
# x=m^2-x1-x2
x3:=m^2-p1[1]-p2[1] mod n;
# y=m(x1-x3)-y1
m*(p1[1]-x3) mod n;
y3:=%-p1[2] mod n;
# Assemble the coordinates into a single point.
p3:=[x3,y3];
end if;
end if;
if z=1 then
NULL;
else if gcd(p2[1]-p1[1],n)<>1 then
z:=1;
z1:=gcd(p2[1]-p1[1],n);
else
end if;
end if;
if z=1 then
NULL;
else
# If points are different, then we are in the first case of the braces on p. 352.
if p1<>p2 then
# First compute the slope m=(y2-y1)/(x2-x1)
m:= (p2[2]-p1[2])/(p2[1]-p1[1]) mod n;
z:=1;
# Using the value of the slope, compute the sum.
# x=m^2-x1-x2
x3:=m^2-p1[1]-p2[1] mod n;
# y=m(x1-x3)-y1
m*(p1[1]-x3) mod n;
y3:=%-p1[2] mod n;
# Assemble the coordinates into a single point.
p3:=[x3,y3];
end if;
end if;
# If there is no problem with relative primeness, return the sum.
# Otherwise return the error message.
if z1=1 then
return(p3);
else
return(["factor=",z1]);
end if;
end:
p. 522, Example 2.Add two finite elliptic curve points.addell([1,3],[3,5],24,13,29);Add two elliptic curve points, one of which is the point at infinity.addell([1,3],["infinity","infinity"],24,13,29);multsell:=proc(p1,m,a,b,n)
local i,z;
z:=[[1,p1]];
for i from 2 while i<=m and z[-1][2][1]<>"factor=" do
z:=[op(z),[1+nops(z),addell(p1,z[nops(z)][2],a,b,n)]];
end do;
return(z);
end:
multell:=proc(p,m,a,b,n)
local i,j,q,y,z1;
y:=["infinity","infinity"];
q:=p;
z1:=m;
for i from 1 while z1<>0 and y[1]<>"factor=" do
for j from 1 while z1 mod 2=0 and q[1]<>"factor=" do
z1:=z1/2;
q:=addell(q,q,a,b,n);
end do;
z1:=z1-1;
y:=addell(q,y,a,b,n);
end do;
if q[1]="factor=" then
y:=q
else
NULL
end if;
return(y);
end:
p. 522, Example 4
Multiply a point on an elliptic curve by 7, for for the elliptic curve LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYwLUklbXN1cEdGJDYlLUkjbWlHRiQ2JVEieUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21uR0YkNiRRIjJGJy9GNlEnbm9ybWFsRicvJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLUkjbW9HRiQ2LVEpJmVxdWFscztGJ0Y8LyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZHLyUpc3RyZXRjaHlHRkcvJSpzeW1tZXRyaWNHRkcvJShsYXJnZW9wR0ZHLyUubW92YWJsZWxpbWl0c0dGRy8lJ2FjY2VudEdGRy8lJ2xzcGFjZUdRLDAuMjc3Nzc3OGVtRicvJSdyc3BhY2VHRlYtRiw2JS1GLzYlUSJ4RidGMkY1LUY5NiRRIjNGJ0Y8Rj4tRkI2LVEnJnBsdXM7RidGPEZFRkhGSkZMRk5GUEZSL0ZVUSwwLjIyMjIyMjJlbUYnL0ZYRl9vLUY5NiRRIzI0RidGPC1GQjYtUTEmSW52aXNpYmxlVGltZXM7RidGPEZFRkhGSkZMRk5GUEZSL0ZVUSYwLjBlbUYnL0ZYRmhvRmVuRltvLUY5NiRRIzEzRidGPC1GQjYtUSJ+RidGPEZFRkhGSkZMRk5GUEZSRmdvRmlvLUZCNi9RJG1vZEYnLyUlYm9sZEdGNC9GNlElYm9sZEYnLyUrZm9udHdlaWdodEdGZnBGRUZIRkpGTEZORlBGUkZnb0Zpb0ZdcC1GOTYkUSMyOUYnRjxGPA==.multell([1,3],7,24,13,29);p. 522, Example 6multell([1,3],12,-5,13,11*19);multsell:=proc(p1,m,a,b,n)
local i,z;
z:=[[1,p1]];
for i from 2 while i<=m and z[-1][2][1]<>"factor=" do
z:=[op(z),[1+nops(z),addell(p1,z[nops(z)][2],a,b,n)]];
end do;
return(z);
end:
p. 523, Example 5
See the intermediate points as one does a multiplication of an integer 40 times a point [1,3] on the elliptic curve LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYwLUklbXN1cEdGJDYlLUkjbWlHRiQ2JVEieUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21uR0YkNiRRIjJGJy9GNlEnbm9ybWFsRicvJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLUkjbW9HRiQ2LVEpJmVxdWFscztGJ0Y8LyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZHLyUpc3RyZXRjaHlHRkcvJSpzeW1tZXRyaWNHRkcvJShsYXJnZW9wR0ZHLyUubW92YWJsZWxpbWl0c0dGRy8lJ2FjY2VudEdGRy8lJ2xzcGFjZUdRLDAuMjc3Nzc3OGVtRicvJSdyc3BhY2VHRlYtRiw2JS1GLzYlUSJ4RidGMkY1LUY5NiRRIjNGJ0Y8Rj4tRkI2LVEnJnBsdXM7RidGPEZFRkhGSkZMRk5GUEZSL0ZVUSwwLjIyMjIyMjJlbUYnL0ZYRl9vLUY5NiRRIzI0RidGPC1GQjYtUTEmSW52aXNpYmxlVGltZXM7RidGPEZFRkhGSkZMRk5GUEZSL0ZVUSYwLjBlbUYnL0ZYRmhvRmVuRltvLUY5NiRRIzEzRidGPC1GQjYtUSJ+RidGPEZFRkhGSkZMRk5GUEZSRmdvRmlvLUZCNi9RJG1vZEYnLyUlYm9sZEdGNC9GNlElYm9sZEYnLyUrZm9udHdlaWdodEdGZnBGRUZIRkpGTEZORlBGUkZnb0Zpb0ZdcC1GOTYkUSMyOUYnRjxGPA==.multsell([1,3],40,24,13,29);The following strings are included so you don't have to type them in certain exercises, but can just copy and paste instead..gaul:="gaulisdividedintothreeparts":
ycve:="ycvejqwvhqtdtwvwu":
edsg:="edsgickxhuklzveqzvkxwkzukcvuh":
tcab:="tcabtiqmfheqqmrmvmtmaq":
lcll:="lcllewljazlnnzmvyiylhrmhza":
DNA:="GAATTCGCGGCCGCAATTAACCCTCACTAAAGGGATCTCTAGAACT":
xkju:="xkjurowmllpxwznpimbvbqjcnowxpcchhvvfvsllfvxhazityxohulxqojaxelxzxmyjaqfs\134
tsrulhhucdskbxknjqidallpqslluhiaqfpbpcidsvcihwhwewthbtxrljnrsncihuvffuxvoukjlj\134
swmaqfvjwjsdyljogjxdboxajultucpzmpliwmlubzxvoodybafdskxgqfadshxnxehsaruojaqfpf\134
kndhsaafvulluwtaqfrupwjrszxgpfutjqiynrxnyntwmhcukjfbirzsmehhsjshyonddzzntzmpli\134
lrwnmwmlvuryonthuhabwnvw":
ocwy:= "ocwyikoooniwugpmxwktzdwgtssayjzwyemdlbnqaaavsuwdvbrflauplooubfgqhgcscmgz\134
latoedcsdeidpbhtmuovpiekifpimfnoamvlpqfxejsmxmpgkccaykwfzpyuavtelwhrhmwkbbvgtg\134
uvtefjlodfefkvpxsgrsorvgtajbsauhzrzalkwuowhgedefnswmrciwcpaaavogpdnfpktdbalsis\134
urlnpsjyeatcuceesohhdarkhwotikbroqrdfmzghgucebvgwcdqxgpbgqwlpbdaylooqdmuhbdqgm\134
yweuik":
hdsf:= "hdsfgvmkoowafweetcmfthskucaqbilgjofmaqlgspvatvxqbiryscpcfrmvswrvnqlszd\134
mgaoqsakmlupsqforvtwvdfcjzvgsoaoqsacjkbrsevbelvbksarlscdcaarmnvrysywxqgvellcyl\134
uwwveoafgclazowafojdlhssfiksepsoywxafowlbfcsocylngqsyzxgjbmlvgrggokgfgmhlmejab\134
sjvgmlnrvqzcrggcrghgeupcyfgtydycjkhqluhgxgzovqswpdvbwsffsenbxapasgazmyuhgsfhmf\134
tayjxmwznrsofrsoaopgauaaarmftqsmahvqecev":
vvhq:= "vvhqwvvrhmusgjgthkihtssejchlsfcbgvwcrlryqtfsvgahwkcuhwauglqhnslrljshbl\134
tspisprdxljsveeghlqwkasskuwepwqtwvspgoelkcqyfnsvwljsniqkgnrgybwlwgoviokhkazkqk\134
xzgyhcecmeiujoqkwfwvefqhkijrclrlkbienqfrjljsdhgrhlsfqtwlauqrhwdmwlgusgikkflryv\134
cwvspgpmlkassjvoqxeggveyggzmljcxxljsvpaivwikvrdrygfrjljslveggveyggeiapuuisfpbt\134
gnwwmuczrvtwglrwugumnczvile":
L100:=[1,0,0,1,1,0,0,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,1,1,1,1,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0]:
L011:=[0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,1,1,1,0,1,0,1]:
L101:=[1,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1,0,1,0,1,0,0,0,1,1,0,0,1,1, 1,1,0,1,1,1,0,1,0,1,1,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,0,0]:
rsan:= 11438162575788886766923577997614661201021829672124236256256184293570693\134
5245733897830597123563958705058989075147599290026879543541:
rsae:= 9007:
rsaci:= 9686961375462206147714092225435588290575999112457431987469512093081629\134
8225145708356931476622883989628013391990551829945157815154:
rsap:= 3490529510847650949147849619903898133417764638493387843990820577:
rsaq:= 32769132993266709549961988190834461413177642967992942539798288533:
naive:= 152415787501905985701881832150835089037858868621211004433:
cnaive:= 141077461765569500241199505617854673388398574333341423525:
n1:=8834884587090814646372459890377418962766907:
sigpairm1:=418726553997094258577980055061305150940547956:
sigpairs1:=749142649641548101520133634736865752883277237:
sigpairm2:=14823765232498712344512418717130930:
sigpairs2:=43176121628465441340112418672065063:
signa:=171024704183616109700818066925197841516671277:
signb:=839073542734369359260871355939062622747633109:
sigpb:=98763457697834568934613:
sigqb:=8495789457893457345793:
Matrix
golay:=matrix(12,24,[1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1]):
golayb:=matrix(12,12,[1,1,1,0,1,1,1,0,0,0,1,0,1,0,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,0,1,1,1,0,0,0,1,0,1,0,1,1,0,1,1,1,0,0,1,0,0,1,0,1,1,0,1,1,1,0,1,0,0,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1,1,0,1,0,1,1,1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1]):
hammingpc:=matrix(4,15,[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1]):
DON'T FORGET TO HIT RETURN TO LOAD THE ABOVE COMMANDS BEFORE STARTING YOUR WORK. PUT THE CURSOR HERE, OR HIGHER, BEFORE HITTING RETURN.