reserve a,b,d,n,k,i,j,x,s for Nat;

theorem :: Problem 68
  a > 0 & b > 0 implies
    ex N be infinite Subset of NAT st
       for n,m be Nat,p be Prime st n in N & m in N  holds
          p divides ArProg(b,a).n iff p divides ArProg(b,a).m
proof
  assume
A1: a > 0 & b > 0;
  set d = a gcd (a+b);
  consider a1,c be Nat such that
A2: a = d*a1 & a+b = d*c & a1,c are_coprime by A1,NUMBER03:18;
  reconsider a1 as non zero Nat by A1,A2;
A3: a1 >= 1 by NAT_1:14;
A4: c > 1
  proof
    c <>0 by A1,A2;
    then
A5: c >= 1 by NAT_1:14;
    assume c <= 1;
    then
A6: c = 1 by A5,XXREAL_0:1;
    a+0 < a+b by A1,XREAL_1:8;
    hence thesis by A6,A2,A3,XREAL_1:66;
  end;
  then c >= 1+1 by NAT_1:13;
  then c |^ Euler a1 > Euler a1 >= 1 by NAT_1:14,NEWTON:86;
  then
A7: c |^ Euler a1 > 1 by XXREAL_0:2;
A8: for n be Nat holds a1 divides (c |^ Euler a1) |^(n+1) - 1
  proof
    let n be Nat;
    a1 >= 1 by NAT_1:14;
    then per cases by XXREAL_0:1;
    suppose a1 = 1;
      hence thesis by INT_2:12;
    end;
    suppose
A9:   a1 > 1;
      c <>0 by A2,A1;
      then (c |^ Euler a1) mod a1 = 1 by A2,A9,EULER_2:18;
      then (c |^ Euler a1) |^(n+1) mod a1 = 1 = 1 mod a1 by NEWTON05:15;
      hence thesis by INT_4:23;
    end;
  end;
  deffunc F(Nat) = c * (((c |^ Euler a1) |^($1+1) - 1)/a1) +1;
  consider f be Function such that
A10: dom f = NAT & for x be Element of NAT holds f.x = F(x) from FUNCT_1:sch 4;
A11: rng f c= NAT
  proof
    let y be object;
    assume y in rng f;
    then consider x be object such that
A12:  x in dom f & f.x=y by FUNCT_1:def 3;
    reconsider x as Element of NAT by A12,A10;
    c <> 0 by A1,A2;
    then consider tn be Nat such that
A13:  a1*tn = (c |^ Euler a1) |^(x+1) - 1 by A8,NAT_D:def 3;
    (((c |^ Euler a1) |^(x+1) - 1)/a1) = tn *(a1/a1) by A13,XCMPLX_1:74
    .= tn*1 by XCMPLX_1:60;
    then y = c*tn+1 by A10,A12;
    hence thesis;
  end;
  for x1,x2 being object st x1 in dom f & x2 in dom f & f.x1=f.x2 holds x1=x2
  proof
    let x1,x2 be object such that
A14:  x1 in dom f & x2 in dom f & f.x1=f.x2;
    reconsider x1,x2 as Element of NAT by A14,A10;
    F(x1)=f.x1 & F(x2)=f.x2 by A10;
    then c * (((c |^ Euler a1) |^(x1+1) - 1)/a1) +1 =
    c * (((c |^ Euler a1) |^(x2+1) - 1)/a1) +1 by A14;
    then ((c |^ Euler a1) |^(x1+1) - 1)/a1
    = ((c |^ Euler a1) |^(x2+1) - 1)/a1 by A4,XCMPLX_1:5;
    then a1*((c |^ Euler a1) |^(x1+1) - 1)
    = a1*((c |^ Euler a1) |^(x2+1) - 1) by XCMPLX_1:95;
    then (c |^ Euler a1) |^(x1+1) - 1
    = (c |^ Euler a1) |^(x2+1) - 1 by XCMPLX_1:5;
    then x1+1=x2+1 by A7,PEPIN:30;
    hence thesis;
  end;
  then reconsider N=rng f as infinite Subset of NAT
    by FUNCT_1:def 4,A11,A10,CARD_1:59;
  take N;
A15:for n be Nat,p be Prime st n in N  holds
  p divides ArProg(b,a).n iff p divides d or p divides c
  proof
    let n be Nat,p be Prime such that
A16:  n in N;
    consider x be object such that
A17:  x in dom f & f.x=n by A16,FUNCT_1:def 3;
    reconsider x as Element of NAT by A17,A10;
    c <> 0 by A1,A2;
    then consider tn be Nat such that
A18:  a1*tn = (c |^ Euler a1) |^(x+1) - 1 by A8,NAT_D:def 3;
    (((c |^ Euler a1) |^(x+1) - 1)/a1) = tn *(a1/a1) by A18,XCMPLX_1:74
    .= tn*1 by XCMPLX_1:60;
    then n = c*tn+1 by A10,A17;
    then
A19: ArProg(b,a).n = b + a*(c*tn+1) by NUMBER06:7
    .= a*c*tn + c*d by A2
    .= d*c*(a1*tn)+c*d by A2
    .= d*c*((c |^ Euler a1) |^(x+1) - 1)+c*d by A18
    .= d*c*((c |^ Euler a1) |^(x+1))
    .= d*c*(c |^ ((x+1)*Euler a1) ) by NEWTON:9
    .= d*(c*(c |^ ((x+1)*Euler a1) ))
    .= d*(c |^ (1+ (x+1)*Euler a1)) by NEWTON:6;
    hereby assume p divides ArProg(b,a).n;
      then p divides d or p divides (c |^ (1+ (x+1)*Euler a1)) by A19,INT_5:7;
      hence p divides d or p divides c by NAT_3:5;
    end;
    assume p divides d or p divides c;
    then p divides d or p divides (c |^ (1+ (x+1)*Euler a1)) by NEWTON02:14;
    hence thesis by A19,NAT_D:9;
  end;
  let n,m be Nat,p be Prime such that
A20: n in N & m in N;
  p divides ArProg(b,a).n iff p divides d or p divides c by A20,A15;
  hence thesis by A20,A15;
end;
