Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# probe: recursion, // and % on Int
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: 6 1 9
# expect-stdout: 12 42
# expect-stdout: lcm 1..10: 2520
def gcd(a: Int, b: Int) -> Int:
if b == 0:
return a
return gcd(b, a % b)
def lcm(a: Int, b: Int) -> Int:
return a // gcd(a, b) * b
def main():
print(gcd(48, 18), gcd(17, 5), gcd(0, 9))
print(lcm(4, 6), lcm(21, 6))
var total = 1
for k in range(1, 11):
total = lcm(total, k)
print("lcm 1..10:", total)