题解 | #完全数计算#
完全数计算
http://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
while True:
try:
M = int(input())
me = 0
for N in range(4,M+1):
a = 0
for ii in range(1,int(N**(1/2))+1):
if N % ii == 0:
a += ii
a += N//ii
if a - N == N:
me += 1
print(me)
except:
break
try:
M = int(input())
me = 0
for N in range(4,M+1):
a = 0
for ii in range(1,int(N**(1/2))+1):
if N % ii == 0:
a += ii
a += N//ii
if a - N == N:
me += 1
print(me)
except:
break