tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,72 @@
|
|||
( ( self-referential
|
||||
= seq N next
|
||||
. ( next
|
||||
= R S d f
|
||||
. 0:?S
|
||||
& whl
|
||||
' (@(!arg:%@?d ?arg)&(.!d)+!S:?S)
|
||||
& :?R
|
||||
& whl
|
||||
' ( !S:#?f*(.?d)+?S
|
||||
& !f !d !R:?R
|
||||
)
|
||||
& str$!R
|
||||
)
|
||||
& 1:?N
|
||||
& !arg:?seq
|
||||
& whl
|
||||
' ( next$!arg:?arg
|
||||
& ~(!seq:? !arg ?)
|
||||
& !arg !seq:?seq
|
||||
& 1+!N:?N
|
||||
)
|
||||
& (!seq.!N)
|
||||
)
|
||||
& ( Perm
|
||||
= permutations S p
|
||||
. :?permutations
|
||||
& ( perm
|
||||
= prefix List original A Z p
|
||||
. !arg:(?prefix.)
|
||||
& str$!prefix:?p
|
||||
& (!S:?+(.!p)+?|(.!p)+!S:?S)
|
||||
| !arg:(0 ?.?)&
|
||||
| !arg:(?prefix.?List:?original)
|
||||
& whl
|
||||
' ( @(!List:%?A ?Z)
|
||||
& perm$(!prefix !A.!Z)
|
||||
& str$(!Z !A):~!original:?List
|
||||
)
|
||||
)
|
||||
& 0:?S
|
||||
& perm$(.!arg)
|
||||
& :?permutations
|
||||
& whl
|
||||
' ( !S:?*(.?p)+?S
|
||||
& !p !permutations:?permutations
|
||||
)
|
||||
& !permutations
|
||||
)
|
||||
& -1:?i:?max
|
||||
& :?seqs
|
||||
& whl
|
||||
' ( 1+!i:<1000000:?i
|
||||
& ( @(!i:? %@?a >%@!a ?)
|
||||
| self-referential$!i
|
||||
: ( ?seq
|
||||
. ( >!max:?max&:?seqs
|
||||
| !max
|
||||
)
|
||||
& ( "Seed Value(s):" Perm$!i
|
||||
. "Sequence: (same for all three seeds except for first element)
|
||||
"
|
||||
!seq
|
||||
)
|
||||
!seqs
|
||||
: ?seqs
|
||||
)
|
||||
|
|
||||
)
|
||||
)
|
||||
& out$("Iterations:" !max !seqs)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue