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,33 @@
var cr = @[1]
var cs = @[2]
proc extendRS =
let x = cr[cr.high] + cs[cr.high]
cr.add x
for y in cs[cs.high] + 1 ..< x: cs.add y
cs.add x + 1
proc ffr(n: int): int =
assert n > 0
while n > cr.len: extendRS()
cr[n - 1]
proc ffs(n: int): int =
assert n > 0
while n > cs.len: extendRS()
cs[n - 1]
for i in 1..10: stdout.write ffr i," "
echo ""
var bin: array[1..1000, int]
for i in 1..40: inc bin[ffr i]
for i in 1..960: inc bin[ffs i]
var all = true
for x in bin:
if x != 1:
all = false
break
if all: echo "All Integers 1..1000 found OK"
else: echo "All Integers 1..1000 NOT found only once: ERROR"