from collections import defaultdict

def strict_divisor_sum(n):
    return 1 + sum(((d if d * d == n else d + n // d) for d in range(2, int(n**0.5) + 1) if n % d == 0))

N = 150000
dct = defaultdict(set)
for n in range(1, N):
    s = strict_divisor_sum(n)
    dct[s].add(n)

for k in dct:
    for v in dct[k]:
        if k in dct.get(v,set()) and k < v:
            print(k, v)  

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: