Initial commit
Test (in pplus-core) / in-core (push) Failing after 28m44s

This commit is contained in:
alexm committed 2026-11-12 22:23:48 -05:00
commit 568474d52f
1591 files changed
+528213

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
# probe: while loops, a step count, and tracking a maximum
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: longest below 30: 27 with 111 steps
# expect-stdout: 111
def steps(n0: Int) -> Int:
var n = n0
var count = 0
while n != 1:
if n % 2 == 0:
n = n // 2
else:
n = 3 * n + 1
count += 1
return count
def main():
var best = 0
var best_n = 1
for n in range(1, 30):
var s = steps(n)
if s > best:
best = s
best_n = n
print("longest below 30:", best_n, "with", best, "steps")
print(steps(27))