Created
September 2, 2022 06:55
-
-
Save theabhayprajapati/e4fb0b5156c746f4b397033e47bbb7e1 to your computer and use it in GitHub Desktop.
Prove by mathematical induction n(n+1)(n+2) is divisible by 24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" prove by mathematical induction n(n+1)(n+2) is divisible by 24 """ | |
def main(n): | |
""" main function """ | |
if n * (n + 1) * (n + 2) % 6 == 0: | |
print(n, "is divisible by 6") | |
return main(n + 1) | |
else: | |
print(n, "is not divisible by 6") | |
n += 1 | |
return main(n) | |
main(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment