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,66 @@
func[] bnadd a[] b[] .
if len a[] < len b[] : swap a[] b[]
for i = 1 to len a[]
bi = 0
if i <= len b[] : bi = b[i]
h = a[i] + bi + c
r[] &= h mod 10000000
c = h div 10000000
.
if c > 0 : r[] &= c
return r[]
.
func[] bnsub a[] b[] .
for i = 1 to len a[]
ai = a[i]
bi = 0
if i <= len b[] : bi = b[i]
bi += c
c = 0
if bi > ai
ai += 10000000
c = 1
.
r[] &= ai - bi
.
while r[$] = 0 : len r[] -1
return r[]
.
func$ str bn[] .
s$ = bn[$]
for i = len bn[] - 1 downto 1
h$ = bn[i]
s$ &= substr "0000000" 1 (7 - len h$) & h$
.
return s$
.
proc calc i &p[][] .
subr upd
if k mod 2 = 1
h[] = bnadd p[i][] p[i - j][]
else
h[] = bnsub p[i][] p[i - j][]
.
p[i][] = h[]
.
while 1 = 1
k += 1
j = k * (3 * k - 1) div 2
if j > i : return
upd
j += k
if j > i : return
upd
.
.
proc partitions_p n &p[][] .
len p[][] n + 1
p[0][] = [ 1 ]
for i to n : calc i p[][]
.
t0 = systime
nn = 6666
partitions_p nn p[][]
print str p[nn][]
print ""
print systime - t0 & "s"

View file

@ -0,0 +1,35 @@
local bigint = require "pluto:bigint"
require "table2"
local p = {}
local pd = {}
local part_diff_diff = |n| -> (n & 1 == 1) ? (n + 1) / 2 : n + 1
local function part_diff(n)
if n < 2 then return 1 end
pd[n] = pd[n-1] + part_diff_diff(n - 1)
return pd[n]
end
local function partitions_p(n)
if n < 2 then return end
local psum = bigint.new(0)
for i = 1, n do
local pdi = part_diff(i)
if pdi > n then break end
local sign = (i - 1) % 4 < 2 ? 1 : -1
psum += p[n - pdi] * sign
end
p[n] = psum
end
local N = 6666
p = table.rep(N, 0)
pd = table.rep(N, 0)
p[0] = bigint.new(1)
p[1] = p[0]
pd[0] = 1
pd[1] = 1
for n = 2, N do partitions_p(n) end
print($"p[{N}] = {p[N]}")

View file

@ -0,0 +1,5 @@
P ← |1 memo(
Terms ← ⊂1+1\+♭⍉˜⊟+1⊸×2↘1⇡20
⨬(⨬(/+ ≡(P-) Terms¤|1)⊸=₁|0)⊸≤₀
)
P69 # Bigger results look like they've already lost precision.