Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarmaladeKnight/bbc0cd4f3f4ef97131cacc52eb8676fd to your computer and use it in GitHub Desktop.
Save MarmaladeKnight/bbc0cd4f3f4ef97131cacc52eb8676fd to your computer and use it in GitHub Desktop.
Hotfix
var
value, i, j, pow :integer;
function func(a, b: integer): integer;
var index: integer;
begin
index := 0;
while (a mod b = 0) do
begin
a := a div b;
index := index + 1;
end;
func := index;
end;
begin
readln(value);
i := 2;
while (value <> 1) do
begin
pow := func(value, i);
if pow <> 0 then
for j := 0 to pow - 1 do
begin
value := value div i;
write(i, ' * ');
end;
i := i + 1
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment