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,12 @@
require 'stats'
permfrom=: ,/@(perm@[ {"_ 1 comb) NB. get permutations of length x from y possible items
alluniq=: # = #@~. NB. check items are unique
addto12=: 12 = +/ NB. check items add to 12
iseven=: -.@(2&|) NB. check items are even
policeeven=: {.@iseven NB. check first item is even
conditions=: policeeven *. addto12 *. alluniq
Validnums=: >: i.7 NB. valid Department numbers
getDeptNums=: [: (#~ conditions"1) Validnums {~ permfrom

View file

@ -0,0 +1,15 @@
3 getDeptNums 7
4 1 7
4 7 1
6 1 5
6 5 1
2 3 7
2 7 3
2 4 6
2 6 4
4 2 6
4 6 2
6 2 4
6 4 2
4 3 5
4 5 3

View file

@ -0,0 +1,6 @@
(/:"#. 2|]) (#~ 12=+/"1) 1+3 comb 7 [ load'stats'
4 1 7
6 1 5
2 3 7
2 4 6
4 3 5

View file

@ -0,0 +1,24 @@
NB. 3 departments, 1..7 in each
#rule1=. >,{3#<1+i.7
343
NB. total must be 12, numbers must be unique
#rule2=. (#~ ((3=#@~.) * 12=+/)"1) rule1
30
NB. no odd numbers in police department (first department)
#rule3=. (#~ 0=2|{."1) rule2
14
rule3
2 3 7
2 4 6
2 6 4
2 7 3
4 1 7
4 2 6
4 3 5
4 5 3
4 6 2
4 7 1
6 1 5
6 2 4
6 4 2
6 5 1