Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
var n = 1234
say n.isqrt
say n.iroot(2)

View file

@ -0,0 +1,10 @@
func rootint(n, k=2) {
return 0 if (n == 0)
var (s, v) = (n, k - 1)
loop {
var u = ((v*s + (n // s**v)) // k)
break if (u >= s)
s = u
}
s
}

View file

@ -0,0 +1,8 @@
func isqrt(x) { var (q, r) = (1, 0); while (q <= x) { q <<= 2 }
while (q > 1) { q >>= 2; var t = x-r+q; r >>= 1
if (t >= 0) { (x, r) = (t, r+q) } } r }
say isqrt.map(0..65).join(' '); printf("\n")
for n in (1..73 `by` 2) {
printf("isqrt(7^%-2d): %42s\n", n, isqrt(7**n).commify) }