/*******************************************************************************
+
+  LEDA 7.2.3  
+
+
+  kmult.c
+
+
+  Copyright (c) 1995-2026
+  by Algorithmic Solutions Software GmbH
+  All rights reserved.
+ 
*******************************************************************************/



#include <LEDA/system/basic.h>
#include <LEDA/numbers/integer.h>
#include <LEDA/core/IO_interface.h>

using namespace leda;

using std::cout;
using std::cin;
using std::endl;
using std::flush;



int main(int argc, char** argv)
{ 

  integer::use_karatsuba = true;

/*
  cout << endl;
  int nmax = read_int("nmax = ");
*/

  int n = 100000;

  if (argc > 1) n = atoi(argv[1]);


  rand_int.set_seed(n);

  integer a = integer::random(n);


  float T0 = 0;

  cout << endl;
  cout << endl;

  //while (n <= nmax)
  for(;;)
  {
     cout << string("n = %9d  ",n) << flush;
     float T = used_time();
     a = a*a;
     float T1 = used_time(T);
     cout << string("%6.2f sec   ",T1);
     if (T0 != 0) cout << string("f = %.2f",T1/T0); 
     cout << endl;
     n = 2*n;
     T0 = T1;
  }

return sign(a);
}


