# [Tutor] problem solving with lists

Dennis Lee Bieber wlfraed at ix.netcom.com
Thu Mar 17 13:57:42 EDT 2022

```On Thu, 17 Mar 2022 12:38:04 -0400, Dennis Lee Bieber
<wlfraed at ix.netcom.com> declaimed the following:

>On Thu, 17 Mar 2022 15:36:57 +0100, <marcus.luetolf at bluewin.ch> declaimed
>the following:
>
>>° The problem with 6  instead of 9 letters cannot be solved for mathematical
>>reasons (below).
>>
>
>	What is the source for these "mathematical reasons"... That is, some
>text (wikipedia, other source) besides your less than clear description.
>

After all, there ARE solutions for any scheme where r<n (technically,
r=n has ONE solution -- the entire source pool as the only element)

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 6 2
Accepted items: 15
af bc bd be
bf cd ce cf
de df ef

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 6 3
Accepted items: 5
bdf

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 6 4
Accepted items: 2
abcd acef

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 6 5
Accepted items: 1
abcde

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>
C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 5 2
Accepted items: 10
bc bd be cd
ce de

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 5 3
Accepted items: 3

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 5 4
Accepted items: 1
abcd

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 5 5
Accepted items: 1
abcde

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 6 6
Accepted items: 1
abcdef

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 9 9
Accepted items: 1
abcdefghi

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 2 1
Accepted items: 2
a b

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>

>>> for n in range(1, 9+1):
... 	for r in range(2, n+1):
... 		print("%s %s: %s" % (n, r, ((n-1) % (r-1)) == 0))
...
2 2: True
3 2: True
3 3: True
4 2: True
4 3: False
4 4: True
5 2: True
5 3: True
5 4: False
5 5: True
6 2: True
6 3: False
6 4: False
6 5: False
6 6: True
7 2: True
7 3: True
7 4: True
7 5: False
7 6: False
7 7: True
8 2: True
8 3: False
8 4: False
8 5: False
8 6: False
8 7: False
8 8: True
9 2: True
9 3: True
9 4: False
9 5: True
9 6: False
9 7: False
9 8: False
9 9: True
>>>

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 9 6
Accepted items: 2
abcdef aceghi

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>letters.rex 9 5
Accepted items: 3

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>

9/5 passes the modulo constraint, 9/6 does not -- but what does that
constraint provide to the problem solution as both 9/5 and 9/6 generate
passing elements.

--
Wulfraed                 Dennis Lee Bieber         AF6VN
wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

```