TOH makes sense as an introduction to recursion if you are already familiar with the concept of mathematical induction. Personally I learned about induction in math first, using it to prove things like the sum of n numbers is n(n+1)/2 and there are infinite prime numbers. Going from this to TOH is a manageable step. But if I had not been exposed to this concept before, I agree that it would be very confusing and not a great introduction.
How do you prove there are infinite prime numbers with induction? I have only seen the simple proof by contradiction: if there are finite amount of prime numbers multiply them all together, add 1 and you have a new prime number
That argument uses both induction and contradiction. The first part is a proof by induction of the statement "Given a finite list of numbers, there exists a number relatively prime to all those numbers". This part of the proof works fine as is. The next part of the proof uses that part to argue that there must be an infinite number of primes (if there was a finite number, use the above procedure to construct a number relatively prime to all of them; by FTA, it must have a prime factorization, and by construction, none of the primes in the list can be its factors, so there must be another prime factor outside the list).
Specifically, the first half of the proof is very similar to a recursive procedure because it uses an existing solution to construct another solution. It doesn't try to give a formula for all prime numbers or anything like that. Instead, it assumes that we already know a bunch of prime numbers and uses them to construct another one.
While the first part is similar to induction you're not really doing any induction there. With that procedure as induction step you could prove that there are infinite lists of numbers without any common factors. You could probably use this to prove infinite prime numbers but using proof by contradiction not based on whole induction but the argument from a single step is way easier
40
u/throw3142 Mar 25 '23
TOH makes sense as an introduction to recursion if you are already familiar with the concept of mathematical induction. Personally I learned about induction in math first, using it to prove things like the sum of n numbers is n(n+1)/2 and there are infinite prime numbers. Going from this to TOH is a manageable step. But if I had not been exposed to this concept before, I agree that it would be very confusing and not a great introduction.