Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Count-in-factors/DWScript/count-in-factors.dw
Normal file
18
Task/Count-in-factors/DWScript/count-in-factors.dw
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function Factorize(n : Integer) : String;
|
||||
begin
|
||||
if n <= 1 then
|
||||
Exit('1');
|
||||
var k := 2;
|
||||
while n >= k do begin
|
||||
while (n mod k) = 0 do begin
|
||||
Result += ' * '+IntToStr(k);
|
||||
n := n div k;
|
||||
end;
|
||||
Inc(k);
|
||||
end;
|
||||
Result:=SubStr(Result, 4);
|
||||
end;
|
||||
|
||||
var i : Integer;
|
||||
for i := 1 to 22 do
|
||||
PrintLn(IntToStr(i) + ': ' + Factorize(i));
|
||||
Loading…
Add table
Add a link
Reference in a new issue