clc; clear; wq = []; for i = 2:10000 sum = 0; k = 1; for j = 2: i / 2 if mod(i,j) == 0 sum = sum + j; end end if sum + 1 == i wq=[wq i]; end end disp(['2至10000之间的完全数有: ',num2str(wq)])
clc; clear; wq = []; for i = 2:10000 sum = 0; k = 1; for j = 2: i / 2 if mod(i,j) == 0 sum = sum + j; end end if sum + 1 == i wq=[wq i]; end end disp(['2至10000之间的完全数有: ',num2str(wq)])