public void TotientPerformance() { if (!bRunExpensive) { return; } Ticker tick = new Ticker(); Totient tot = new Totient(p, 9900000); tick.Tick("Generated first ~ten million"); int iMax; iMax = 0; while (!tick.SecondsElapsed(5) && iMax < 1000000) { iMax++; tot.Crappy(iMax); } tick.Tick("Crappy Max Value = " + iMax); iMax = 0; while (!tick.SecondsElapsed(5) && iMax < 1000000) { iMax++; tot.OK(iMax); } tick.Tick("OK Max Value = " + iMax); iMax = 0; while (!tick.SecondsElapsed(5) && iMax < 1000000) { iMax++; tot.Best(iMax); } tick.Tick("Best Max Value = " + iMax); }
public void CrappyTest() { Totient t = new Totient(null); for (int i = 1; i < iaTots.Length; i++) { Assert.AreEqual(iaTots[i], t.Crappy(i)); } if (bRunExpensive) { //Assert.AreEqual(3015360, t.Crappy(9799998)); //Assert.AreEqual(2799792, t.Crappy(9799398)); //Assert.AreEqual(3195896, t.Crappy(9796398)); Assert.AreEqual(400000, t.Crappy(1000000)); } }