Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,37 @@
require "table2"
local fmt = require "fmt"
local function ncs(a)
local f = "%d "
if type(a[1]) == "string" then
for i = 1, #a do a[i] = a[i]:byte(1) end
f = "%c "
end
local function generate(m, k, c)
if k == m then
if c[m] != c[1] + m - 1 then
for i = 1, m do fmt.write(f, a[c[i]]) end
print()
end
else
for j = 1, #a do
if k == 0 or j > c[k] then
c[k + 1] = j
generate(m, k + 1, c)
end
end
end
end
for m = 2, #a - 1 do
local c = table.rep(m, 0)
generate(m, 0, c)
end
end
local a = {1, 2, 3, 4}
ncs(a)
print()
local ca = {"a", "b", "c", "d", "e"}
ncs(ca)