Project Euler #204: Generalised Hamming Numbers

  • + 0 comments

    def is_hamming_numbers(x):`

    if x == 1:
        return 1
    if x % 2 == 0:
        return is_hamming_numbers(x / 2)
    if x % 3 == 0:
        return is_hamming_numbers(x / 3)
    if x % 5 == 0:
        return is_hamming_numbers(x / 5)
    return 0
    

    c = 1

    for i in range(1, 100000000): if is_hamming_numbers(i) == True:

    I am getting timeout errors here

        c += 1
    

    print(c) `