Anonymous user
Talk:Permutations with repetitions: Difference between revisions
Talk:Permutations with repetitions (view source)
Revision as of 06:49, 22 September 2016
, 7 years ago→Isn't it just similar to "Increment_a_numerical_string": new section
m (→another variant of the: changed the section header name. -- ~~~~) |
(→Isn't it just similar to "Increment_a_numerical_string": new section) |
||
(One intermediate revision by one other user not shown) | |||
Line 62:
<br>If any of these improvements could/would be of use, that's fine. I plan to delete this entry in a couple of weeks. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 04:2013 (UTC)
<lang rexx>/*REXX*/ parse arg n m s names
if n='' then n=
if m='' then m=2
if
else parse var names e.k names▼
do k=1 to n
if names='' then e.k=k
end /*k*/
a=''
do i=1 to m; a=a'do d'i"=1 to n;"; end /*i*/
a=a'z=e.d1'
do j=2 to m; a=a"||s||e.d"j; end /*j*/
a=a';say z'copies(";end",m)
if m==0 then do; say '1 permutation, a "null".'; exit; end
interpret a
say n**m 'permutations'</lang>
== Isn't it just similar to "Increment_a_numerical_string" ==
You set the length of the string to n fill it completly with "0" and set the base to k.
http://rosettacode.org/wiki/Increment_a_numerical_string#Pascal
Of course you can use an array of integer instead.
|