Last active
March 24, 2022 16:53
-
-
Save igorvanloo/7b415fa80e316a2faf4b60d4127c7810 to your computer and use it in GitHub Desktop.
admissible numbers
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
def admissible_numbers(p, n, primes, limit): | |
a_n = [n] #admissible numbers | |
i = primes.index(p) #index | |
if n > limit: | |
return [] | |
a_n += admissible_numbers(p, n*p, primes, limit) | |
if i + 1 < len(primes): | |
n_p = primes[i + 1] #next prime | |
a_n += admissible_numbers(n_p, n*n_p, primes, limit) | |
return a_n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment