Documentation

Archive.Imo.Imo1962Q1

IMO 1962 Q1 #

Find the smallest natural number $n$ which has the following properties:

(a) Its decimal representation has 6 as the last digit.

(b) If the last digit 6 is erased and placed in front of the remaining digits, the resulting number is four times as large as the original number $n$.

Since Lean does not explicitly express problems of the form "find the smallest number satisfying X", we define the problem as a predicate, and then prove a particular number is the smallest member of a set satisfying it.

Equations
Instances For

    First, it's inconvenient to work with digits, so let's simplify them out of the problem.

    @[reducible, inline]
    Equations
    Instances For

      Now we can eliminate possibilities for (digits 10 c).length until we get to the one that works.

      theorem Imo1962Q1.case_0_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 0) :
      theorem Imo1962Q1.case_1_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 1) :
      theorem Imo1962Q1.case_2_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 2) :
      theorem Imo1962Q1.case_3_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 3) :
      theorem Imo1962Q1.case_4_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 4) :
      theorem Imo1962Q1.case_5_digits {c : } {n : } (hc : (Nat.digits 10 c).length = 5) (hpp : Imo1962Q1.ProblemPredicate' c n) :
      c = 15384
      theorem Imo1962Q1.case_more_digits {c : } {n : } (hc : (Nat.digits 10 c).length 6) (hpp : Imo1962Q1.ProblemPredicate' c n) :
      n 153846

      linarith fails on numbers this large, so this lemma spells out some of the arithmetic that normally would be automated.

      Now we combine these cases to show that 153846 is the smallest solution.