reserve a,b,i,k,m,n for Nat;
reserve s,z for non zero Nat;
reserve r for Real;
reserve c for Complex;
reserve e1,e2,e3,e4,e5 for ExtReal;

theorem Th26:
  a <> 0 & b <> 0 & i <> 0 implies (i|^a - 1) gcd (i|^b - 1) = i|^(a gcd b) - 1
  proof
    set d = a gcd b;
    assume that
A1: a <> 0 & b <> 0 and
A2: i <> 0;
    1 <= i by A2,NAT_1:14;
    then per cases by XXREAL_0:1;
    suppose
A3:   i = 1;
      then (i|^a - 1) gcd (i|^b - 1) = 0 gcd (1|^b-1)
      .= i|^(a gcd b) - 1 by A3;
      hence thesis;
    end;
    suppose
A4:   1 < i;
      consider A,B being Nat such that
A5:   a = d*A and
A6:   b = d*B and
A7:   A,B are_coprime by A1,Th18;
      A <> 0 & B <> 0 by A1,A5,A6;
      then reconsider a1 = A-1, b1 = B-1 as Nat;
      set x = i|^d;
      set P = Partial_Sums(x GeoSeq);
      A = a1+1 & B = b1+1;
      then P.a1,P.b1 are_coprime by A7,Th25;
      then
A8:   (x-1)*(P.a1 gcd P.b1) = x-1;
A9:   1 <= d by A1,NAT_1:14;
      1+1 <= i by A4,NAT_1:13;
      then
A10:  x > d by NEWTON:86;
      then
A11:  x-1 <> 1-1 by A9;
A12:  |.x-1.| = x-1 by A4,ABSVALUE:def 1;
      P.a1 = (1 - x to_power (a1+1)) / (1-x) by A9,A10,SERIES_1:22
      .= (-(1 - x to_power (a1+1))) / -(1-x) by XCMPLX_1:191
      .= (x to_power A - 1) / (x-1);
      then
A13:  (P.a1)*(x-1) = x|^A-1 by A11,XCMPLX_1:87;
      P.b1 = (1 - x to_power (b1+1)) / (1-x) by A9,A10,SERIES_1:22
      .= (-(1 - x to_power (b1+1))) / -(1-x) by XCMPLX_1:191
      .= (x to_power B - 1) / (x-1);
      then
A14:  (P.b1)*(x-1) = x|^B-1 by A11,XCMPLX_1:87;
      i|^a = x|^A & i|^b = x|^B by A5,A6,NEWTON:9;
      hence (i|^a - 1) gcd (i|^b - 1) = i|^d - 1 by A8,A13,A14,A12,INT_6:16;
    end;
  end;
