Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
25
Task/Count-in-factors/PascalABC.NET/count-in-factors.pas
Normal file
25
Task/Count-in-factors/PascalABC.NET/count-in-factors.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// https://rosettacode.org/wiki/Count_in_factors#PascalABC.NET
|
||||
|
||||
function Factorize(x: integer): List<integer>;
|
||||
begin
|
||||
Result := new List<integer>;
|
||||
if x = 1 then
|
||||
begin
|
||||
Result.Add(1);
|
||||
exit
|
||||
end;
|
||||
var i := 2;
|
||||
repeat
|
||||
if x.Divs(i) then
|
||||
begin
|
||||
Result.Add(i);
|
||||
x := x div i;
|
||||
end
|
||||
else i += 1;
|
||||
until x = 1;
|
||||
end;
|
||||
|
||||
begin
|
||||
var n := 22;
|
||||
(1..n).PrintLines(x -> $'{x,3}: {Factorize(x).JoinToString('' * '')}')
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue