//Autor: Artur Czekalski (Sator)  www.epokaY.net/artur  artur@epokaY.net
#include "stdafx.h"
#include <stdlib.h> //_i64toa
#include <windows.h> //GetTickCount()

char gBufor[256];
//---------------------------------------------------------------------------
inline __int64 NWD(__int64 a, __int64 b) //największy wspólny dzielnik
{if (a==0i64 && b==0i64) return 1i64;
 __int64 temp;
 while (b)
  {temp = b;  b = a%b;  a = temp;
  }
 return a;
}
//---------------------------------------------------------------------------
inline __int64 NWW(__int64 a, __int64 b) //najmniejsza wspólna wielokrotność
{return a*b / NWD(a,b);
}
//===========================================================================
int main(int, char* [])
{
 __int64 i, w, max = 0i64;
 int czas; 

 czas = GetTickCount();
 for (i=1i64; i<=10000000i64; ++i)
  {w = NWW(902337203685i64-i, i);
   if (w > max) max = w;
  }
 czas = GetTickCount() - czas;

 printf("max=%s", _i64toa(max, gBufor, 10));
 printf("\nVisual C++ 6.0: Czas=%d", czas);
 getchar();  return 0;
}