program ;
var
i, a: longint;
x,
u, j,
n, m : longint;
function fdiv (a, left : longint) : longint;
var
d,
i : longint;
begin
d : = 1;
for i : = left to trunc (sqrt (a)) do
if (a mod i = 0)
then
begin
d : = i;
break;
end;
if (d < > 1)
then
fdiv : = d
else
fdiv : = a;
end;
function g (n, u : longint) : longint;
var
i : longint;
begin
i : = 0;
while (n mod u = 0)
do
begin
inc (i);
n : = n div u;
end;
g : = i;
end;
begin
assign (input, 'input.txt');
assign (output, 'output.txt');
reset (input);
read (a);
close (input);
m : = 0;
n : = 1;
i : = fdiv (a, 2);
u : = 2;
while (a > 1)
do
begin
n : = n * i;
j : = 0;
while (a mod i = 0)
do
begin
inc (j);
a : = a div i;
end;
if (j > m)
then
begin
m : = j;
u : = i;
end;
i : = fdiv (a, i + 2);
end;
x : = 1;
while (g (n * x, u) * n * x < m)
do
inc (x);
n : = n * x;
rewrite (output);
write (n);
close (output);
end.
Поделитесь своими знаниями, ответьте на вопрос:
Доклад(крадко Использование программных систем и сервисов
/// PascalABC.Net 3.4.2, 2053(11.05.19)
var
a, n: longint;
text: textfile;
function myMod(num, power, divider: longint): longint;
var
rest, i: longint;
begin
rest:=1;
divider := abs(divider);
for i := 1 to power do
begin
rest := rest * num;
rest := rest mod divider;
end;
myMod := rest;
end;
begin
assign(text, 'input.txt');
{rewrite(text);
writeln(text, 109);
close(text);}
reset(text);
read(text, a);
writeln('a=', a);
close(text);
n := 1;
repeat
n := n + 1;
until MyMod(n, n, a) = 0;
assign(text, 'output.txt');
rewrite(text);
writeln(text, n);
close(text);
{reset(text);
read(text, n);
writeln('n=', n);
close(text);}
end.