Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
17
Task/Magic-constant/PascalABC.NET/magic-constant.pas
Normal file
17
Task/Magic-constant/PascalABC.NET/magic-constant.pas
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
##
|
||||
function magic(n: biginteger) := n * (n * n + 1) div 2;
|
||||
|
||||
println('The first 20 magic constants:');
|
||||
(1 + 2..22).Select(x -> magic(x)).Println;
|
||||
println;
|
||||
|
||||
println('The 1,000th magic constant:',magic(1000 + 2),#10);
|
||||
|
||||
for var n := 1 to 20 do
|
||||
begin
|
||||
write('10^', n, ': ');
|
||||
(1..maxint).Select(x -> biginteger(x))
|
||||
.SkipWhile(x -> magic(x) < power(10bi, n))
|
||||
.First
|
||||
.Println;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue