code wiki / _hdl_build / nx_researcher_derive_gate.nx
nx_researcher_derive_gate.nx
buildroot/runtime/_hdl_build/nx_researcher_derive_gate.nx
dependencies 3 imports · 0 importers
imports: nx_gate_gn.nxnx_gate_base.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const SUMSQ_N: i64 = 20 |
functions
| 25 | func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" calls 1: gw |
| 27 | func derive_closed_form(N: i64) -> i64 { return (N*(N+1)*((2*N)+1))/6 } |
| 29 | func derive_direct_sum(N: i64) -> i64 { var s: i64=0; var i: i64=1; while i<=N { s=s+(i*i); i=i+1 } return s } |
| 31 | func derive_combinatorial(N: i64) -> i64 { let c3: i64=((N+1)*N*(N-1))/6; return (2*c3)+((N*(N+1))/2) } |
| 33 | func derive_buggy(N: i64) -> i64 { var s: i64=0; var i: i64=1; while i<N { s=s+(i*i); i=i+1 } return s } // misses N^2 |
| 36 | func derive_corroborate(N: i64) -> i64 |
| 42 | func main() -> i64 |