function writeLink() { 

// CHANGE THEOREM COUNT DATA HERE 
numberofthms=60;
var dayperm =[2, 3, 4, 5, 6, 49, 7, 8, 9, 10, 11, 46, 45, 12, 13, 14, 15, 16, 17, 47, 56, 51, 57, 53, 18, 19, 20, 48, 59, 21, 22, 58, 23, 24, 55, 25, 26, 27, 28, 50, 29, 30, 31, 32, 33, 34, 35, 52, 44, 36, 37, 38, 54, 39, 40, 41, 42, 43, 0, 1]
// constant when the list of theorems is increased. 

baseTime = new Date(2005, 0, 1); // year, month, day 
nowTime = new Date(); 
millisecondsSince = nowTime - baseTime; 
daysSince = Math.floor(millisecondsSince/86400000); 
// daysSince is the number of days since baseTime 
modDaysSince = daysSince % numberofthms; 
// limit to the number of different files

today=dayperm[modDaysSince];

// write a link using the number as part of the file name 
theorems = new Array(numberofthms) 
theorems[0] = "NumberTheory/Euclid/TotDEuclid.pdf"; 
theorems[1] = "NumberTheory/ChineseRemainder/TotDCRT.pdf"; 
theorems[2] = "CombinatorialTheory/BruckRyserChowla/TotDBRC.pdf"; 
theorems[3]= "NumberTheory/Fundamental/TotDArithmetic.pdf";
theorems[4] = "Analysis/FundamentalAlgebra/TotDFTA.pdf"; 
theorems[5] = "Analysis/FundamentalCalculus/TotDFTC.pdf"; 
theorems[6] = "Statistics/CentralLimit/TotDCLT.pdf"; 
theorems[7] = "CombinatorialTheory/FourColour/TotD4CT.pdf"; 
theorems[8] = "NumberTheory/FermatsLast/TotDFLT.pdf"; 
theorems[9] = "Statistics/Bayes/TotDBayes.pdf"; 
theorems[10] = "NumberTheory/Lagrange/TotDLagrange.pdf"; 
theorems[11] = "CombinatorialTheory/MTT/TotDMTT.pdf"; 
theorems[12] = "NumberTheory/FermatsLittle/TotDLittleFermat.pdf"; 
theorems[13] = "LogicAndComputerScience/Cook/TotDCook.pdf"; 
theorems[14] = "GroupTheory/OrbitCounting/TotDOCL.pdf"; 
theorems[15] = "Topology/Sperner/TotDSperner.pdf"; 
theorems[16] = "LogicAndComputerScience/Well-Ordering/TotDWellOrdered.pdf"; 
theorems[17] = "Topology/Brouwer/TotDBrouwer.pdf"; 
theorems[18] = "CombinatorialTheory/Dilworth/TotDDilworth.pdf";
theorems[19] = "Analysis/MertonCollege/TotDMCT.pdf";
theorems[20] = "NumberTheory/Brun/TotDBrun.pdf";
theorems[21] = "LogicAndComputerScience/CantorUncountable/TotDCantorU.pdf";
theorems[22] = "LogicAndComputerScience/Cantor/TotDCantor.pdf";
theorems[23] = "CombinatorialTheory/Kuratowski/TotDKuratowski.pdf";
theorems[24] = "CombinatorialTheory/Wagner/TotDWagner.pdf";
theorems[25] = "CombinatorialTheory/Euler/TotDEuler.pdf";
theorems[26] = "GeometryAndTrigonometry/Pythagoras/TotDPythagoras.pdf";
theorems[27] = "CombinatorialTheory/Ramsey/TotDRamsey.pdf";
theorems[28] = "NumberTheory/QuadraticReciprocity/TotDReciprocity.pdf";
theorems[29] = "LogicAndComputerScience/DPRM/TotDDPRM.pdf";
theorems[30] = "Statistics/Benford/TotDBenford.pdf";
theorems[31] = "NumberTheory/PrimeSequences/TotDPrimeSequences.pdf";
theorems[32] = "NumberTheory/PrimeNumber/TotDPrimeNumber.pdf";
theorems[33] = "GroupTheory/FirstIsomorphism/TotDIsomorphism1.pdf";
theorems[34] = "GroupTheory/SecondIsomorphism/TotDIsomorphism2.pdf";
theorems[35] = "GeometryAndTrigonometry/EulerIdentity/TotDEulerIdentity.pdf";
theorems[36] = "GeometryAndTrigonometry/Girard/TotDGirard.pdf";
theorems[37] = "Binomial/Lucas/TotDLucas.pdf";
theorems[38] = "Binomial/Pascal/TotDPascal.pdf";
theorems[39] = "Binomial/Stirling/TotDStirling.pdf";
theorems[40] = "GroupTheory/Lagrange/TotDLagrange.pdf";
theorems[41] = "Binomial/Zeckendorf/TotDZeckendorf.pdf";
theorems[42] = "Statistics/LargeNumbers/TotDLargeNumbers.pdf";
theorems[43] = "GeometryAndTrigonometry/Pappus/TotDPappus.htm";
theorems[44] = "Binomial/Binet/TotDBinet.pdf";
theorems[45] = "CombinatorialTheory/DTransitive/TotDDTransitive.pdf";
theorems[46] = "Binomial/Binomial/TotDBinomial.pdf";
theorems[47] = "CombinatorialTheory/LineGraph/TotDBeineke.pdf";
theorems[48] = "GroupTheory/Netto/TotDNetto.pdf";
theorems[49] = "CombinatorialTheory/EulerTours/TotDEulerTours.pdf";
theorems[50] = "GroupTheory/MChan/TotDMChan.pdf";
theorems[51] = "CombinatorialTheory/Robertson-Seymour/TotDRobertsonSeymour.pdf";
theorems[52] = "Statistics/Bailey/TotDBailey.pdf";
theorems[53] = "CombinatorialTheory/MOLS/TotDMOLS.pdf";
theorems[54] = "GeometryAndTrigonometry/Miquel/TotDMiquel.htm";
theorems[55] = "GeometryAndTrigonometry/Morley/TotDMorley.htm";
theorems[56] = "CombinatorialTheory/Birkhoff/TotDBirkhoff.pdf";
theorems[57] = "GroupTheory/FiniteFields/TotDFiniteFields.pdf";
theorems[58] = "NumberTheorem/Germain/TotDGermain.pdf";
theorems[59] = "CombinatorialTheory/SPGT/TotDSPGT.pdf";

document.write("<A HREF='http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/" + theorems[today]+"'>Theorem of the Day</A>");
 } 

