The brute force

    ls
[: *./ [: (# = #@:~.)"1 (, |:)

tests whether a square is Latin, given that the n by n square contains elements 
of 1+i.n  --Kip Murray


On 10/4/2010 9:07 PM, Roger Hui wrote:
> When I learned Latin squares in college they
> were defined on A B C D ... There is another kind
> called Greco-Latin squares
> http://en.wikipedia.org/wiki/Greco-Latin_square
> which has another Latin square using α β γ ...
> superimposed on top of a Latin Square.
>
> One time, Ken wondered out loud why it's called
> a "Greco-Latin square".  I suggested that because
> they use Greek and Latin letters, but that it was
> only my guess.  Ken said in an exasperated voice,
> "I bet you are right!  That makes as much sense
> as the name 'lambda calculus'!"
>
>
>
> ----- Original Message -----
> From: Henry Rich<[email protected]>
> Date: Monday, October 4, 2010 18:04
> Subject: Re: [Jprogramming] Distinct Numbers in Rows and Columns
> To: Programming forum<[email protected]>
>
>> I was just using Roger's problem statement.  If you want to
>> make it
>> independent of index origin, replace<: with (->./@,)
>>
>> http://mathworld.wolfram.com/LatinSquare.html says a Latin
>> square uses
>> numbers 1-n.  FWIW.
>>
>> Henry Rich
>>
>> On 10/4/2010 8:57 PM, Don Guinn wrote:
>>> I made a simple Latin square and tried your definition.
>>>
>>>       z=:3 3$1 2 3 2 3 1 3 1 2
>>>       z
>>> 1 2 3
>>> 2 3 1
>>> 3 1 2
>>>       hr=:-.@(0&e.)@:(C.!.2)@(,|:)@:<:"2
>>>       hr z
>>> 1
>>>       hr>:z
>>> 0
>>>
>>> I think that incrementing all numbers in z should still
>> produce a Latin
>>> square.
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Oct 4, 2010 at 7:13 PM, Henry
>> Rich<[email protected]>   wrote:
>>>
>>>> I got to
>>>>
>>>> -.@(0&e.)@:(C.!.2)@(,|:)@:<:"2
>>>>
>>>> as the test for whether the item is a Latin square.  I
>> have been trying
>>>> to find some cool test, without success.
>>>>
>>>> Henry Rich
>>>>
>>>> On 10/4/2010 7:37 PM, Roger Hui wrote:
>>>>> Great minds think alike, eh?  (But I think you
>>>>> need to test your expressions ;-)  Go to
>>>>> http://www.jsoftware.com/jwiki/Essays/KenKen
>>>>> and look about a third of the way down,
>>>>>
>>>>> q #~ (8$15) -:"1 (+/"1 ,. +/"2) q{0,2^i.4
>>>>>
>>>>> The initial effort in your previous msg is also
>>>>> similar to my initial effort.
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: Marshall Lochbaum<[email protected]>
>>>>> Date: Monday, October 4, 2010 16:28
>>>>> Subject: Re: [Jprogramming] Distinct Numbers in Rows and Columns
>>>>> To: 'Programming forum'<[email protected]>
>>>>>
>>>>>> Here's a funny--and much faster--one:
>>>>>> p=.p:i.n
>>>>>> *./"1 (*/p) = (*/"2 ,. */"1) q{p
>>>>>>
>>>>>> Actually, I suppose it is better to do it with addition, so
>>>>>> p=.2^i.n
>>>>>> *./"1 (+/p) = (+/"2 ,. +/"1) q{p
>>>>>>
>>>>>> Marshall
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: [email protected]
>>>>>> [mailto:[email protected]] On Behalf Of
>> Roger Hui
>>>>>> Sent: Monday, October 04, 2010 6:41 PM
>>>>>> To: Programming forum
>>>>>> Subject: [Jprogramming] Distinct Numbers in Rows and Columns
>>>>>>
>>>>>> An interesting puzzle arising from the KenKen solver:
>>>>>> q is an array with shape (m,n,n) and  (,q) e. 1+i.n .
>>>>>> Which items of q have 1+i.n in each row and in each column?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to