static double SumGeometricElements(int a1, int alim, double t)
{
if (t < 0 || t > 1)
throw new ArgumentException("Progression step cannot be less than zero or greater than one");
if (a1 <= alim)
return 0;
double result = a1;
double lastElement = a1;
while (lastElement * t > alim)
lastElement *= t;
result += lastElement;
}
return result;