using System.Collections.Generic;
public static int GetLogDiff(double n)
double np1 = Math.Log(n+1) / logB * M; n = Math.Log(n) / logB * M;
for (int i = 1; true; ++i) {
double m = Math.Pow(M, i);
if ((int)(np1 * m + 0.5) != (int)(n * m + 0.5)) return i;
public static void Main()
DateTime t0 = DateTime.Today, last = t0;
var a = new List<DateTime>();
int t = 0, j, nSweep = 0;
while (a.Count < 512) a.Add(last = t0.AddSeconds(t++));
for (int i = j = 0, k = (int)x; i < a.Count; ++i)
if (nSweep == 0) Console.WriteLine("del="+(a.Count - j));
a.RemoveRange(j, a.Count - j); ++nSweep;
Console.WriteLine("{0:yyyy'-'MM'-'dd'T'HH':'mm':'ss} {1,2}. {2}",
last, nSweep, String.Join(" ", a.Skip(1).Select((tt,ii) => (tt - a[ii]).TotalSeconds).Take(20)));