Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 370 Bytes

29. Distinct powers.md

File metadata and controls

13 lines (10 loc) · 370 Bytes

Question

How many distinct terms are in the sequence generated by eq for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?

Solution

def p29(N = 100):
    return len(set(a ** b for a in range(2, N + 1) for b in range(2, N + 1)))

Answer

9183