code wiki / (root) / _ro_probe_fx_isqrt_20397.nx

_ro_probe_fx_isqrt_20397.nx source

↩ module page · 26 lines · 936 B

1// GENERATED by nx_retire_onto prove; transient, named per function and pid, removed after the run 2import "_ro_fixture_cons.nx" 3import "_ro_fixture_owner.nx" 4func main() -> i64 { 5 var v: i64 = 0 6 while v <= 1048576 { if fx_isqrt(v) != sh_ident(v) { return 1 } v = v + 1 } 7 var k: i64 = 20 8 while k < 63 { 9 let p: i64 = 1 << k 10 if fx_isqrt(p) != sh_ident(p) { return 1 } 11 if fx_isqrt(p - 1) != sh_ident(p - 1) { return 1 } 12 if fx_isqrt(p + 1) != sh_ident(p + 1) { return 1 } 13 if fx_isqrt(0 - p) != sh_ident(0 - p) { return 1 } 14 k = k + 1 15 } 16 var m: i64 = 0 - 1 17 while m > 0 - 1048577 { if fx_isqrt(m) != sh_ident(m) { return 1 } m = m * 2 } 18 var s: i64 = 1024 19 while s < 3037000499 { 20 let q: i64 = s * s 21 if fx_isqrt(q) != sh_ident(q) { return 1 } 22 if fx_isqrt(q - 1) != sh_ident(q - 1) { return 1 } 23 s = s * 3 / 2 + 1 24 } 25 return 0 26}