Data update

This commit is contained in:
Ingy döt Net 2025-06-11 20:16:52 -04:00
parent 72eb4943cb
commit 4d5544505c
2347 changed files with 62432 additions and 16731 deletions

View file

@ -0,0 +1,82 @@
import ballerina/io;
function pow(int n, int e) returns int {
if e < 1 { return 1; }
int prod = 1;
foreach int i in 1...e { prod *= n; }
return prod;
}
function commatize(int n) returns string {
string s = n.toString();
if n < 0 { s = s.substring(1); }
int le = s.length();
foreach int i in int:range(le - 3, 0, -3) {
s = s.substring(0, i) + "," + s.substring(i);
}
if n >= 0 { return s; }
return "-" + s;
}
public function main() {
int prod = 1;
int sum = 0;
int x = 5;
int y = -5;
int z = -2;
int one = 1;
int three = 3;
int seven = 7;
int p = pow(11, x);
int j = 0;
var process = function() {
sum += j.abs();
if (prod.abs() < (1 << 27) && j != 0) { prod *= j; }
};
j = -three;
while j <= pow(3, 3) {
process();
j += three;
}
j = -seven;
while j <= seven {
process();
j += x;
}
j = 555;
while j <= 550 - y {
process();
j += 1;
}
j = 22;
while j >= -28 {
process();
j -= three;
}
j = 1927;
while j <= 1939 {
process();
j += 1;
}
j = x;
while j >= y {
process();
j -= -z;
}
j = p;
while j <= p + one {
process();
j += 1;
}
io:println("sum = ", commatize(sum));
io:println("prod = ", commatize(prod));
}