def right_truncatable_harshad_numbers(): for ex in takewhile(lambda x: x <= EXPONENT, count(start=1)): for h in harshad_numbers[ex - 1]: k = 10 * h for d in range(10): candidate = k + d if not (candidate % digit_sum(candidate)): harshad_numbers[ex].append(candidate) yield candidate
def is_strong(h): return is_prime(h / digit_sum(h))
def convergents_of_e(): length = 100 chain_fraction = prepare_quotient_list(length) approximation = reversed_euklid(chain_fraction) return digit_sum(approximation.numerator)