public void OkTest() { Totient t = new Totient(p); for (int i = 1; i < iaTots.Length; i++) { Assert.AreEqual(iaTots[i], t.OK(i)); } Assert.AreEqual(3015360, t.OK(9799998)); Assert.AreEqual(2799792, t.OK(9799398)); Assert.AreEqual(3195896, t.OK(9796398)); Assert.AreEqual(400000, t.OK(1000000)); }
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); }