Inventory sequence: Difference between revisions

Content added Content deleted
(→‎{{header|RPL}}: improved code)
(Added Quackery.)
Line 621: Line 621:
</pre>
</pre>
[[File:Inventory Sequence.png|500px|thumb|center]]
[[File:Inventory Sequence.png|500px|thumb|center]]

=={{header|Quackery}}==

<syntaxhighlight lang="Quackery">
[ over 0 unrot
witheach
[ over = if
[ dip 1+ ] ]
drop join ] is countem ( [ n --> [ )

0 temp put
[]
4000 times
[ temp share countem
dup -1 peek 0 >
temp over iff
tally else replace ]
temp release
witheach
[ dup 10 < if sp
echo sp
i^ 40 mod 39 = if cr ]
cr
0 temp put
[]
[ temp share countem
dup -1 peek 0 >
temp over iff
tally else replace
dup -1 peek 999 > until ]
temp release
say "Element #"
dup size echo
say " is "
-1 peek 1 - echo
say "."</syntaxhighlight>

{{out}}

<pre> 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

Element #24255 is 1001.</pre>



=={{header|Raku}}==
=={{header|Raku}}==