function arith_mod(x,m) {
// since -1 % m appears to be undefined in javascript!
while (x<0) {x=x+m};
return x % m
}

// CHANGE THEOREM COUNT DATA HERE 
numberofthms=151;
var dayperm =[75, 76, 134, 77, 78, 133, 79, 136, 80, 81, 67, 83, 129, 4, 63, 88, 102, 64, 118, 65, 60, 5, 128, 72, 6, 49, 7, 107, 8, 148, 120, 9, 74, 149, 10, 117, 150, 11, 46, 145, 119, 45, 12, 108, 13, 14, 109, 15, 105, 16, 103, 17, 47, 139, 68, 56, 144, 69, 51, 57, 53, 66, 89, 104, 95, 110, 96, 90, 99, 111, 124, 91, 92, 112, 93, 127, 18, 82, 19, 113, 87, 20, 48, 121, 59, 21, 106, 22, 114, 58, 23, 122, 71, 84, 24, 55, 25, 115, 26, 27, 28, 50, 29, 125, 98, 146, 130, 61, 30, 31, 126, 62, 123, 32, 116, 33, 73, 34, 35, 52, 44, 36, 143, 140, 86, 37, 141, 38, 54, 85, 39, 135, 147, 40, 142, 41, 97, 132, 42, 138, 43, 94, 0, 131, 1, 70, 137, 2, 100, 101, 3]
var linebreak = "<br />";

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];
yesterday=dayperm[arith_mod(modDaysSince-1,numberofthms)];
tomorrow=dayperm[arith_mod(modDaysSince+1,numberofthms)];

// 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.pdf";
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/TotDMOLSsmall.pdf";
theorems[54] = "GeometryAndTrigonometry/Miquel/TotDMiquel.pdf";
theorems[55] = "GeometryAndTrigonometry/Morley/TotDMorley.pdf";
theorems[56] = "CombinatorialTheory/Birkhoff/TotDBirkhoff.pdf";
theorems[57] = "GroupTheory/FiniteFields/TotDFiniteFields.pdf";
theorems[58] = "NumberTheory/Germain/TotDGermain.pdf";
theorems[59] = "CombinatorialTheory/SPGT/TotDSPGT.pdf";
theorems[60] = "GroupTheory/Moufang/TotDMoufang.pdf";
theorems[61] = "CombinatorialTheory/Marriage/TotDMarriage.pdf";
theorems[62] = "GeometryAndTrigonometry/Thales/TotDThales.pdf";
theorems[63] = "GroupTheory/PMNeumann/TotDNeumann.pdf";
theorems[64] = "GroupTheory/Sims/TotDSims.pdf";
theorems[65] = "CombinatorialTheory/IntersectingPerms/TotDIntersecting.pdf";
theorems[66] = "Topology/Reidemeister/TotDReidemeister.pdf";
theorems[67] = "CombinatorialTheory/GaleShapley/TotDGaleShapley.pdf";
theorems[68] = "MathEconomics/Arrow/TotDArrow.pdf";
theorems[69] = "CombinatorialTheory/DegreeColourable/TotDDegreeColourable.pdf";
theorems[70] = "Analysis/Sharkovsky/TotDSharkovsky.pdf";
theorems[71] = "InformationTheory/MacWilliams/TotDMacWilliams.pdf";
theorems[72] = "LogicAndComputerScience/Goodstein/TotDGoodstein.pdf";
theorems[73] = "LogicAndComputerScience/Godel/TotDGodel.pdf";
theorems[74] = "LogicAndComputerScience/Godel2/TotDGodel2.pdf";
theorems[75] = "GeometryAndTrigonometry/Brahmagupta/TotDBrahmagupta.pdf";
theorems[76] = "GeometryAndTrigonometry/Pick/TotDPick.pdf";
theorems[77] = "NumberTheory/ThreeDistance/TotDThreeDistance.pdf";
theorems[78] = "NumberTheory/Fifteen/TotDFifteen.pdf";
theorems[79] = "CombinatorialTheory/OneFactorable/TotDOneFactorable.pdf";
theorems[80] = "NumberTheory/Lutz/TotDLutzNagell.pdf";
theorems[81] = "GroupTheory/Gruenberg/TotDGruenberg.pdf";
theorems[82] = "GeometryAndTrigonometry/Delsarte/TotDDelsarte.pdf";
theorems[83] = "GeometryAndTrigonometry/FiveCircles/TotDFiveCircles.pdf";
theorems[84] = "GroupTheory/Cayley/TotDCayley.pdf";
theorems[85] = "MathPhysics/Noether/TotDNoether.pdf";
theorems[86] = "Binomial/Lame/TotDLame.pdf";
theorems[87] = "Analysis/CauchyKovalevskaya/TotDCauchyKovalevskaya.pdf";
theorems[88] = "Statistics/AbelHurwitz/TotDAbelHurwitz.pdf";
theorems[89] = "Analysis/Cardano/TotDCardano.pdf";
theorems[90] = "NumberTheory/KhinchinCF/TotDKhinchin.pdf";
theorems[91] = "Analysis/Quadratic/TotDQuadratic.pdf";
theorems[92] = "MusicAndArt/Hexachord/TotDHexachord.pdf";
theorems[93] = "CombinatorialTheory/Cayley/TotDCayleyFormula.pdf";
theorems[94] = "Analysis/Convolution/TotDConvolution.pdf";
theorems[95] = "GeometryAndTrigonometry/Sarrus/TotDSarrus.pdf";
theorems[96] = "Analysis/Nevanlinna5/TotDNevanlinna5.pdf";
theorems[97] = "Analysis/Cartwright/TotDCartwright.pdf";
theorems[98] = "GeometryAndTrigonometry/EstherKlein/TotDEstherKlein.pdf";
theorems[99] = "CombinatorialTheory/DoC/TotDDoC.pdf";
theorems[100] = "GeometryAndTrigonometry/Kepler/TotDKepler.pdf";
theorems[101] = "GeometryAndTrigonometry/Viete/TotDViete.pdf";
theorems[102] = "CombinatorialTheory/Parking/TotDParking.pdf";
theorems[103] = "GeometryAndTrigonometry/GMR/TotDGMR.pdf";
theorems[104] = "LogicAndComputerScience/PumpingLemma/TotDPumping.pdf";
theorems[105] = "MusicAndArt/Babbitt/TotDBabbitt.pdf";
theorems[106] = "GeometryAndTrigonometry/Tverberg/TotDTverberg.pdf";
theorems[107] = "GeometryAndTrigonometry/ATST/TotDATST.pdf";
theorems[108] = "OR/BHH/TotDBHH.pdf";
theorems[109] = "LogicAndComputerScience/Robbins/TotDRobbins.pdf";
theorems[110] = "LogicAndComputerScience/DeMorgan/TotDDeMorgan.pdf";
theorems[111] = "CombinatorialTheory/Bregman/TotDBregman.pdf";
theorems[112] = "CombinatorialTheory/VDW/TotDVDW.pdf";
theorems[113] = "GroupTheory/Loops/TotDLoops.pdf";
theorems[114] = "NumberTheory/Partitions/TotDPartitions.pdf";
theorems[115] = "CombinatorialTheory/Coprimality/TotDCoprimality.pdf";
theorems[116] = "CombinatorialTheory/ErdosWilson/TotDErdosWilson.pdf";
theorems[117] = "NumberTheory/Catalan/TotDCatalan.pdf";
theorems[118] = "CombinatorialTheory/Kneser/TotDKneser.pdf";
theorems[119] = "Statistics/Local/TotDLocal.pdf";
theorems[120] = "GeometryAndTrigonometry/Lambert/TotDLambert.pdf";
theorems[121] = "Topology/BorsukUlam/TotDBorsukUlam.pdf";
theorems[122] = "Algebra/Wedderburn/TotDWedderburn.pdf";
theorems[123] = "Analysis/Lagrange/TotDLagrange.pdf";
theorems[124] = "Algebra/SkolemNoether/TotDSkolem.pdf";
theorems[125] = "InformationTheory/Liar/TotDLiar.pdf";
theorems[126] = "NumberTheory/LucasLehmer/TotDLucas.pdf";
theorems[127] = "NumberTheory/EuclidEuler/TotDEuclidEuler.pdf";
theorems[128] = "CombinatorialTheory/MostPerfect/TotDMostPerfect.pdf";
theorems[129] = "GeometryAndTrigonometry/Apollonian/TotDApollonian.pdf";
theorems[130] = "CombinatorialTheory/DDOLS/TotDDDOLS.pdf";
theorems[131] = "GeometryAndTrigonometry/Platonic/TotDPlatonic.pdf";
theorems[132] = "Statistics/TotalProb/TotDTotal.pdf";
theorems[133] = "Analysis/CoV/TotDCoV.pdf";
theorems[134] = "GroupTheory/Movement/TotDMovement.pdf";
theorems[135] = "Binomial/Derangements/TotDDerangements.pdf";
theorems[136] = "Binomial/WallisProduct/TotDWallis.pdf";
theorems[137] = "LogicAndComputerScience/Pratt/TotDPratt.pdf";
theorems[138] = "LogicAndComputerScience/Strassen/TotDStrassen.pdf";
theorems[139] = "CombinatorialTheory/Rigidity/TotDRigidity.pdf";
theorems[140] = "CombinatorialTheory/PiffWelsh/TotDPiffWelsh.pdf";
theorems[141] = "Algebra/Sylvester/TotDSylvester.pdf";
theorems[142] = "GroupTheory/RSK/TotDRSK.pdf";
theorems[143] = "MathPhysics/Lieb/TotDLieb.pdf";
theorems[144] = "Analysis/ContractionMapping/TotDContraction.pdf";
theorems[145] = "CombinatorialTheory/Panarboreal/TotDPanarboreal.pdf";
theorems[146] = "Analysis/Sophomore/TotDSophomore.pdf";
theorems[147] = "Analysis/SchurRealZeros/TotDSchurRealZeros.pdf";
theorems[148] = "GeometryAndTrigonometry/EuclidsPrism/TotDEuclidsPrism.pdf";
theorems[149] = "CombinatorialTheory/HoppingLemma/TotDHoppingLemma.pdf";
theorems[150] = "NumberTheory/SmallGaps/TotDSmallGaps.pdf";

 

function writeLink() { 
/*-----------------------------------------
   Today's Date           by Joe Barta
   http://www.pagetutor.com/todaysdate/
 -----------------------------------------*/

var TodaysDateStyle = 8; //pick a style from below

/*---------------------------
Style 1: March 17, 2005
Style 2: Mar 17, 2005

Style 3: 17 March, 2005
Style 4: 17 Mar, 2005

Style 5: Saturday March 17, 2005
Style 6: Sat March 17, 2005
Style 7: Sat Mar 17, 2005

Style 8: Saturday 17 March, 2005
Style 9: Sat 17 March, 2005
Style 10: Sat 17 Mar, 2005

Style 11: 3/17/05
Style 12: 3/17/2005
Style 13: 17/3/05
Style 14: 17/3/2005

Style 15: Saturday March 17
Style 16: Saturday 17 March
----------------------------*/


function WriteTodaysDate(Style) {

var months = new Array();
months[1] = "January";  months[7] = "July";
months[2] = "February"; months[8] = "August";
months[3] = "March";    months[9] = "September";
months[4] = "April";    months[10] = "October";
months[5] = "May";      months[11] = "November";
months[6] = "June";     months[12] = "December";

var months2 = new Array();
months2[1] = "Jan"; months2[7] = "Jul";
months2[2] = "Feb"; months2[8] = "Aug";
months2[3] = "Mar"; months2[9] = "Sep";
months2[4] = "Apr"; months2[10] = "Oct";
months2[5] = "May"; months2[11] = "Nov";
months2[6] = "Jun"; months2[12] = "Dec";

var days = new Array();
days[1] = "Sunday";    days[5] = "Thursday";
days[2] = "Monday";    days[6] = "Friday";
days[3] = "Tuesday";   days[7] = "Saturday";
days[4] = "Wednesday";

var days2 = new Array();
days2[1] = "Sun"; days2[5] = "Thu";
days2[2] = "Mon"; days2[6] = "Fri";
days2[3] = "Tue"; days2[7] = "Sat";
days2[4] = "Wed";

var todaysdate = new Date();
var date  = todaysdate.getDate();
var day  = todaysdate.getDay() + 1;
var month = todaysdate.getMonth() + 1;
var yy = todaysdate.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var year2 = year - (2000*1); year2 = (year2 < 10) ? "0" + year2 : year2;

var dateline = new Array();
dateline[1] = months[month] + " " + date + ", " + year;
dateline[2] = months2[month] + " " + date + ", " + year;
dateline[3] = date + " " + months[month] + ", " + year;
dateline[4] = date + " " + months2[month] + ", " + year;
dateline[5] = days[day] + " " + months[month] + " " + date + ", " + year;
dateline[6] = days2[day] + " " + months[month] + " " + date + ", " + year;
dateline[7] = days2[day] + " " + months2[month] + " " + date + ", " + year;
dateline[8] = days[day] + " " + date + " " + months[month] + ", " + year;
dateline[9] = days2[day] + " " + date + " " + months[month] + ", " + year;
dateline[10] = days2[day] + " " + date + " " + months2[month] + ", " + year;
dateline[11] = month + "/" + date + "/" + year2;
dateline[12] = month + "/" + date + "/" + year;
dateline[13] = date + "/" + month + "/" + year2;
dateline[14] = date + "/" + month + "/" + year;
dateline[15] = days[day] + " " + months[month] + " " + date;
dateline[16] = days[day] + " " + date + " " + months[month];

document.write("<font size='2'>on "+dateline[Style]+"</font>");
}

document.write("<A HREF='http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/" + theorems[today]+"'><font size='5'>Today's Theorem</font></A>");
document.write("&nbsp;&nbsp;");
WriteTodaysDate(TodaysDateStyle);
document.write(linebreak);document.write(linebreak);
document.write("<A HREF='http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/" + theorems[yesterday]+"'>Yesterday's Theorem</A>"); 
document.write("&nbsp;&nbsp;&nbsp;");
document.write("<A HREF='http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/" + theorems[tomorrow]+"'>Tomorrow's Theorem</A>"); 
document.write("&nbsp;&nbsp;&nbsp;");
document.write("<A HREF='http://www.theoremoftheday.org/Theorems.html'>The Whole Jolly Lot</A>"); 
document.write("<p class='TotD'>&nbsp;</p>")
} 

function todaysURL() {
// return "http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/GeometryAndTrigonometry/Platonic/TotDPlatonic.pdf";
return "http://myweb.lsbu.ac.uk/~whittyr/MathSci/TheoremOfTheDay/"+theorems[today];
}