Advertisement
Guest User

Untitled

a guest
Dec 9th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. from math import sqrt
  2. def list_squared(m, n):
  3.     res = []
  4.     for x in range(m, n+1):
  5.         divisors = []
  6.         for q in range(1, x+1):
  7.             if x % q == 0:
  8.                 divisors.append(q**2)
  9.         if sqrt(sum(divisors)) == int(sqrt(sum(divisors))):
  10.             res.append([x, sum(divisors)])
  11.     return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement