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
  {n where n is odd Nat: n divides 3|^n+1} = {1}
  proof
    set A = {n where n is odd Nat: n divides 3|^n+1};
    thus A c= {1}
    proof
      let x be object;
      assume x in A;
      then consider n being odd Nat such that
A1:   n = x and
A2:   n divides 3|^n+1;
      n = 1
      proof
        assume
A3:     n <> 1;
A4:     (3*3)|^n = 3|^n*3|^n by NEWTON:7;
        (3|^n)^2-1^2 = (3|^n-1)*(3|^n+1);
        then
A5:     n divides 9|^n-1 by A2,A4,INT_2:2;
        defpred P[Nat] means $1 is odd & 1 < $1 & $1 divides 9|^$1-1;
A6:     ex k being Nat st P[k] by A3,A5,NAT_1:25;
        consider N being Nat such that
A7:     P[N] and
A8:     for n being Nat st P[n] holds N <= n from NAT_1:sch 5(A6);
        reconsider N as odd Element of NAT by A7,ORDINAL1:def 12;
        set E = Euler N;
        set d = N gcd E;
A9:     1 mod N = 1 by A7,NAT_D:14;
        reconsider k = 9|^N-1 as Nat;
        9,N are_coprime by A7,Th45;
        then 9|^E mod N = 1 by A7,EULER_2:18;
        then 9|^E-1 mod N = (1-1) mod N by A9,INT_6:7
        .= 0;
        then N divides 9|^E-1 by INT_1:62;
        then
A10:    N divides (9|^N - 1) gcd (9|^E - 1) by A7,INT_2:def 2;
A11:    (9|^N - 1) gcd (9|^E - 1) = 9|^d - 1 by Th26;
A12:    now
          assume d <= 1;
          then d < 1 or d = 1 by XXREAL_0:1;
          then N in {1,2,4,8} by A10,A11,Th12,NAT_1:14;
          then N = 2*1 or N = 2*2 or N = 2*4 by A7,ENUMSET1:def 2;
          hence contradiction;
        end;
A13:    d <= E by Th13;
A14:    d divides N by INT_2:def 2;
A15:    E <= N-1 by A7,EULER_1:19;
        N-1 < N-0 by XREAL_1:15;
        then E < N by A15,XXREAL_0:2;
        then d < N by A13,XXREAL_0:2;
        hence contradiction by A8,A14,A12,A10,A11,INT_2:9;
      end;
      hence thesis by A1,TARSKI:def 1;
    end;
    let x be object;
    assume x in {1};
    then
A16: x = 1 by TARSKI:def 1;
A17: 1 = 2*0+1;
    1 divides 3|^1+1 by INT_2:12;
    hence thesis by A16,A17;
  end;
