Написать решение данной задачи в паскале. Используя только одну подпрограмму, в которой будет проверка делителей на простоту.заданы два целых числа М, N. Определить, больше ли сумма простых делителей числа М, произведения составных делителей числа N.
program PrimeDivisors; var M, N, i, sumPrimeDivisors, productCompositeDivisors: integer; function IsPrime(num: integer): boolean; var j: integer; begin IsPrime := true; if num < 2 then IsPrime := false else begin for j := 2 to num div 2 do begin if num mod j = 0 then begin IsPrime := false; Break; end; end; end; end; begin writeln('Enter two integers M and N:'); readln(M, N); sumPrimeDivisors := 0; productCompositeDivisors := 1; for i := 2 to M div 2 do begin if (M mod i = 0) and IsPrime(i) then sumPrimeDivisors := sumPrimeDivisors + i; end; for i := 2 to N div 2 do begin if (N mod i = 0) and not IsPrime(i) then productCompositeDivisors := productCompositeDivisors * i; end; if sumPrimeDivisors > productCompositeDivisors then writeln('Sum of prime divisors of M is greater than product of composite divisors of N') else if sumPrimeDivisors < productCompositeDivisors then writeln('Sum of prime divisors of M is less than product of composite divisors of N') else writeln('Sum of prime divisors of M is equal to product of composite divisors of N'); end.
var
M, N, i, sumPrimeDivisors, productCompositeDivisors: integer;
function IsPrime(num: integer): boolean;
var
j: integer;
begin
IsPrime := true;
if num < 2 then
IsPrime := false
else
begin
for j := 2 to num div 2 do
begin
if num mod j = 0 then
begin
IsPrime := false;
Break;
end;
end;
end;
end;
begin
writeln('Enter two integers M and N:');
readln(M, N);
sumPrimeDivisors := 0;
productCompositeDivisors := 1;
for i := 2 to M div 2 do
begin
if (M mod i = 0) and IsPrime(i) then
sumPrimeDivisors := sumPrimeDivisors + i;
end;
for i := 2 to N div 2 do
begin
if (N mod i = 0) and not IsPrime(i) then
productCompositeDivisors := productCompositeDivisors * i;
end;
if sumPrimeDivisors > productCompositeDivisors then
writeln('Sum of prime divisors of M is greater than product of composite divisors of N')
else if sumPrimeDivisors < productCompositeDivisors then
writeln('Sum of prime divisors of M is less than product of composite divisors of N')
else
writeln('Sum of prime divisors of M is equal to product of composite divisors of N');
end.