public static ulong Bin(int c, int d, ulong n)
Nbc = Convert.ToInt32(Math.Floor(Math.Log(d,2) + 1));
Console.WriteLine(string.Format("{0,2} {1,0} {2,9} {3,9} {4,9} {5,9} {6 ,9} {7,9} {8,10} {9,9} {10,9}",
"k", "|", "ak", "|" ,"bin", "|", "2 exp k", "|", "c exp d modn","|", "bk"));
Console.WriteLine(string.Format("{0,2} {1,0} {2,9} {3,9} {4,9} {5,9} {6 ,9} {7,9} {8,10} {9,9} {10,9}",
k ,"|"," ","|" ," ","|"," ","|"," ","|", 1));
q = (int)Math.Floor((double)q/ b);
expo = (ulong)Math.Pow(2, k);
tabMod[k] = (ulong)Math.Pow(c, k + 1)% n;
tabMod[k] = (ulong)Math.Pow(tabMod[k - 1],2) % n;
tabB[k] = tabB[k - 1] * tabMod[k] % n;
Console.WriteLine(string.Format("{0,2} {1,0} {2,9} {3,9} {4,9}"+
"{5,9} {6 ,9} {7,9} {8,10} {9,9} {10,9}"
, k, "|", q, "|", tab[k], "|", expo , "|", tabMod[k], "|", tabB[k]));
public static void Main(string[] args)