3 ms·
Ask HN: How do I think about recursion in math and programming?
I got the idea for problems like factorials or finding sum from 1 to n, where there's a pattern visible. Like this:
Source:https://99x.io/blog/recursion-is-not-hard-here-is-the-right-way-to-think
I got it for things like addition, subtraction, division, multiplication of two numbers as well.
eg: a+b
=a+b-1+1
=SUM(a+1,b-1)
Now, I am wondering how it'll be for finding a palindrome of a number? I've a solution but I'm not understanding how we came towards it. I'm looking for how to come towards a solution than a solution itself.
- optbuild 4y agoRecursion is basically the other side of the coin for mathematical induction. I would suggest that you learn a functional programming language and mathematical induction. You can try out: How to Design Programs at https://htdp.org/ https://htdp.org/ if you want to learn more about how recursion is used in programming and where. For mathematical induction you make read: 1. What is Mathematics by Courant and Robbins 2. Introduction to Mathematical Thinking by Keith Devlin