Last active
December 21, 2015 17:18
-
-
Save Drvanon/6339091 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| wonder_numbers = set([2]) | |
| temp_wonder_numbers = set() | |
| def wonder(n): | |
| n = int(n) | |
| if n in wonder_numbers: | |
| print('n is a wonder number') | |
| for i in temp_wonder_numbers: | |
| wonder_numbers.add(i) | |
| return | |
| if not(n % 2): | |
| print(n, ' is an even number, so I will half it which is: ', int(n / 2)) | |
| temp_wonder_numbers.add(n) | |
| wonder(n / 2) | |
| else: | |
| print(n, 'is an odd number so I will do it times three and append it with one: ', 3 * n + 1) | |
| temp_wonder_numbers.add(n) | |
| wonder(3 * n + 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment