Inventory sequence: Difference between revisions

J draft
m (Stopped Wren entry from flowing round let-aligned Raku image without the need to insert a lot of blank lines.)
(J draft)
Line 27:
 
 
 
=={{header|J}}==
 
<syntaxhighlight lang=J>nextinv=: ((*@] * 1+{.@[), }.@[ , ]) +/@({. = }.)
 
10 10$}.nextinv^:100]0 NB. first 100 elements of inventory sequence
0 1 1 0 2 2 2 0 3 2
4 1 1 0 4 4 4 1 4 0
5 5 4 1 6 2 1 0 6 7
5 1 6 3 3 1 0 7 9 5
3 6 4 4 2 0 8 9 6 4
9 4 5 2 1 3 0 9 10 7
5 10 6 6 3 1 4 2 0 10
11 8 6 11 6 9 3 2 5 3
2 0 11 11 10 8 11 7 9 4
3 6 4 5 0 12 11 10 9 13
({:,_2+#)nextinv^:(1000>{:)^:_]0 NB. first value of at least 1000 and its index
1001 24255</syntaxhighlight>
 
=={{header|jq}}==
6,962

edits