Learn to Code ยท zero-dependency ยท MIT

larzmath

Math worked out step by step.

Most maths libraries give you an answer; larzmath shows the working. Euclid's algorithm running to a GCD, a number broken into primes one division at a time, a long division carried out digit by digit - a teaching tool that shows the how, not just the answer.

larzscript pkg install mathx
View on GitHub →Learn the stack

What you get

Try it

import "mathx" as mathx
print(mathx.fib(10))
print(mathx.is_prime(97))
print(mathx.explain_gcd(48, 18))
print(mathx.explain_factorize(84))
Output
55
true
48 = 2*18 + 12
18 = 1*12 + 6
12 = 2*6 + 0
gcd = 6
84 / 2 = 42
42 / 2 = 21
21 / 3 = 7
7 is prime
84 = 2^2 * 3 * 7

Why it's in the Larz Stack

larzmath is a real Larzscript package (larzscript pkg install mathx) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.