mobius
std.elementwise.mobius · Level L4The Möbius function μ(n) for each n ≥ 1: 0 if a square divides n, and otherwise (−1)ᵏ for k distinct prime factors (factor_summary). μ(1) = 1.
μ(n) = 0 if p² | n; (−1)ᵏ for n = p₁⋯pₖ
Signature
mobius(n: i64[s]) → i64[s]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Equal to the reference
0 if a prime repeats in the factorization, else (−1)^(number of primes)in exact rational arithmetic, on all 40 test cases. - All 151 int64 results are exact: the error is zero.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them exact, with zero error.
Accuracy in detail
- correctly rounded (the int64 nearest the exact value)
- 100%
- bit-equal to the NumPy formula in int64
- 100%
- largest error, in units in the last place
- 0
Identity
sha256:8a424c53901bf4f3666443aaf68ee489d9ef6359d418d5cee6752a9872a0f1b4The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.elementwise.mobius · Ω:mobius
- Pins
sha256:3b6aabe95925ec767b04fba43409ec0917bfc7b2a5ae1624c9752b148a37e628this graph and the 3 it reaches through calls- Evidence
sha256:b6d567e5decb4eb7cdce98332cf47168da1053b526e7ff9c177ad01942477b26the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.