Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,38 @@
vc = proc (n, base: int) returns (int, int)
p: int := 0
q: int := 1
while n ~= 0 do
p := p * base + n // base
q := q * base
n := n / base
end
num: int := p
denom: int := q
while p ~= 0 do
p, q := q // p, p
end
return(num/q, denom/q)
end vc
print_frac = proc (po: stream, num, denom: int)
if num=0 then
stream$puts(po, " 0")
else
stream$puts(po, " ")
stream$putright(po, int$unparse(num), 2)
stream$puts(po, "/")
stream$putright(po, int$unparse(denom), 2)
end
end print_frac
start_up = proc ()
po: stream := stream$primary_output()
for base: int in int$from_to(2,5) do
stream$puts(po, "base " || int$unparse(base) || ":")
for i: int in int$from_to(0, 9) do
n, d: int := vc(i, base)
print_frac(po, n, d)
end
stream$putl(po, "")
end
end start_up