Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -4,8 +4,8 @@ mobius: function [n][
f: factors.prime n
if f <> unique f -> return 0
if? odd? size f -> return neg 1
else -> return 1
switch odd? size f -> return neg 1
-> return 1
]
loop split.every:20 map 0..199 => mobius 'a ->

View file

@ -1,28 +0,0 @@
# Moebius function
function Moebius([int]$N) {
[int]$m = 1
if ($N -ne 1) {
[int]$f = 2
do {
if ($N % ($f * $f) -eq 0) {
$m = 0
} else {
if ($N % $f -eq 0) {
$m = -$m;
$N = [math]::Floor($N / $f)
}
$f += 1
}
} while (($f -le $N) -and ($m -ne 0))
}
return $m
}
foreach ($t in 0..9) {
[string]$row = @()
foreach ($u in 1..10) {
$row += "{0,2} " -f $(Moebius(10 * $t + $u))
}
Write-Output $row
}

View file

@ -1,6 +1,7 @@
include Settings
-- 23 Aug 2025
include Setting
say 'MOEBIUS FUNCTION - 4 Mar 2025'
say 'MOEBIUS FUNCTION'
say version
say
numeric digits 100
@ -24,7 +25,4 @@ say Format(Time('e'),,3) 'seconds'
say
return
include Functions
include Numbers
include Sequences
include Abend
include Math

View file

@ -1,36 +0,0 @@
REM Levenshtein distance
DECLARE FUNCTION LevDist(S$, T$) AS INTEGER
DECLARE FUNCTION MIN(A, B) AS INTEGER
PRINT "The Levenshtein distance..."
PRINT "between 'kitten' and 'sitting' is "; LevDist("kitten","sitting")
PRINT "between 'rosettacode' and 'raisethysword' is "; LevDist("rosettacode","raisethysword")
END
FUNCTION LevDist(S$, T$) AS INTEGER
N = LEN(T$): M = LEN(S$)
DIM D(0 TO N, 0 TO N)
FOR I = 0 TO M
D(I, 0) = I
NEXT I
FOR J = 0 TO N
D(0, J) = J
NEXT J
FOR J = 1 TO N
FOR I = 1 TO M
IF MID$(S$, I, 1) = MID$(T$, J, 1) THEN
D(I, J) = D(I - 1, J - 1)
ELSE
D(I, J) = Min(D(I - 1, J) + 1, Min(D(I, J - 1) + 1, D(I - 1, J - 1) + 1))
END IF
NEXT I
NEXT J
LevDist = D(M, N)
END FUNCTION
FUNCTION Min(A, B) AS INTEGER
IF A < B THEN
Min = A
ELSE
Min = B
END IF
END FUNCTION