Actually, grey code is a binary sequence where only 1 bit changes
between each item.

https://en.wikipedia.org/wiki/Gray_code

http://code.jsoftware.com/wiki/Essays/Gray_Code

   ~:/\inv"1 #:i.8
0 0 0
0 0 1
0 1 1
0 1 0
1 1 0
1 1 1
1 0 1
1 0 0

FYI,

-- 
Raul


On Sat, Nov 4, 2017 at 8:26 AM, Erling Hellenäs
<[email protected]> wrote:
> Hi all!
>
> When you do these kind of set operations it is common to represent the set
> as a bitmap with ones for each item. A k-set {0 1 2} of the set {0 1 2 3 4}
> would then be represented like this.
> 1 1 1 0 0
> This is called GRAY CODES.
> One advantage is that you can move an item in only one operation. You don't
> have to remove it somewhere and add it somewhere else. The move can be made
> with exclusive or.
>
>    1 1 ~: 0 1
> 1 0
>    0 0 ~: 0 1
> 0 1
>
> You can switch both zeroes and ones with ones. Zeros do nothing.
> The first example shows a move of a one one step left.
> Two bitmaps of 64 bits can be handled in one assembler instruction. All that
> is needed to create the next set.
> Here is an example of the generation of a 3-set from a 5-set with gray
> codes.
>
>    [q=:10 5 $1 1 1 0 0  0 0 1 1 0  0 0 0 1 1  0 1 1 1 1 0 0 0 1 1  1 1 0 0 0
> 0 0 1 1 0  1 1 0 0 0  1 0 1 0 0  0 1 0 0 1
> 1 1 1 0 0
> 0 0 1 1 0
> 0 0 0 1 1
> 0 1 1 1 1
> 0 0 0 1 1
> 1 1 0 0 0
> 0 0 1 1 0
> 1 1 0 0 0
> 1 0 1 0 0
> 0 1 0 0 1
>    ~:/\ q
> 1 1 1 0 0
> 1 1 0 1 0
> 1 1 0 0 1
> 1 0 1 1 0
> 1 0 1 0 1
> 0 1 1 0 1
> 0 1 0 1 1
> 1 0 0 1 1
> 0 0 1 1 1
> 0 1 1 1 0
>    /:~>(~:/\ q) <@#"1 i.5
> 0 1 2
> 0 1 3
> 0 1 4
> 0 2 3
> 0 2 4
> 0 3 4
> 1 2 3
> 1 2 4
> 1 3 4
> 2 3 4
>
> Cheers,
>
> Erling Hellenäs
>
> On 2017-11-03 18:16, Linda Alvord wrote:
>>
>> It seems that you mighg want to use a diferent name for your combE
>>
>> load 'stats'
>>                 (3 comb 4);3 combE 4
>> ┌─────┬───────┐
>> │0 1 2│0 0 0 1│
>> │0 1 3│0 0 0 2│
>> │0 2 3│0 0 1 1│
>> │1 2 3│0 0 1 2│
>> │     │0 0 2 1│
>> │     │0 0 2 2│
>> │     │0 1 0 1│
>> │     │0 1 0 2│
>> │     │0 1 1 1│
>> │     │0 1 1 2│
>> │     │0 1 2 1│
>> │     │0 1 2 2│
>> │     │0 2 0 1│
>> │     │0 2 0 2│
>> │     │0 2 1 1│
>> │     │0 2 1 2│
>> │     │0 2 2 1│
>> │     │0 2 2 2│
>> │     │1 0 0 1│
>> │     │1 0 0 2│
>> │     │1 0 1 1│
>> │     │1 0 1 2│
>> │     │1 0 2 1│
>> │     │1 0 2 2│
>> │     │1 1 0 1│
>> │     │1 1 0 2│
>> │     │1 1 1 1│
>> │     │1 1 1 2│
>> │     │1 1 2 1│
>> │     │1 1 2 2│
>> │     │1 2 0 1│
>> │     │1 2 0 2│
>> │     │1 2 1 1│
>> │     │1 2 1 2│
>> │     │1 2 2 1│
>> │     │1 2 2 2│
>> └─────┴───────┘
>>     Linda
>>
>>
>> -----Original Message-----
>> From: Programming [mailto:[email protected]] On
>> Behalf Of Erling Hellenäs
>> Sent: Friday, November 3, 2017 12:44 PM
>> To: [email protected]
>> Subject: Re: [Jprogramming] Partitions
>>
>> Hi all!
>>
>> I did not correctly understand the e. verb
>>
>>      24 e. r4
>> 0
>>      24 e. ,r4
>> 1
>>
>> So 358358 surely was there and was double-counted.
>>
>> Cheers,
>>
>> Erling Hellenäs
>>
>> On 2017-11-03 17:07, Erling Hellenäs wrote:
>>>
>>> No, its not. It seems it should have bin there. Maybe something is
>>> wrong. /Erling
>>>
>>> On 2017-11-03 16:56, Erling Hellenäs wrote:
>>>>
>>>> Lol. This root is double-counted. 1 1 1 1 358358 /Erling
>>>>
>>>> On 2017-11-03 16:42, Erling Hellenäs wrote:
>>>>>
>>>>> Hi all!
>>>>>
>>>>> My take:
>>>>>
>>>>>     v=:1 1 1 1 2 7 11 13 179
>>>>>     r=:5 parRuskeyE 9
>>>>>     r2=: >r (*/)@:{&.>"1 0 < v
>>>>>     r3=:/:~"1 r2
>>>>>     r4=: ~.r3
>>>>>     NB. One root is 1 1 1 1 358358
>>>>>     NB. All permutations
>>>>>     (!5)*1+#r4
>>>>> 6360
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Erling Hellenäs
>>>>>
>>>>> On 2017-11-03 15:03, Erling Hellenäs wrote:
>>>>>>
>>>>>> Sorry. Add ones. /Erling
>>>>>>
>>>>>> On 2017-11-03 15:00, Erling Hellenäs wrote:
>>>>>>>
>>>>>>> OK. The five prime factors are needed if you want to multiply 5
>>>>>>> numbers and get 358358, except that you can possibly add zeros and
>>>>>>> 358358 itself? /Erling
>>>>>>>
>>>>>>> On 2017-11-03 14:35, 'Mike Day' via Programming wrote:
>>>>>>>>
>>>>>>>> Language differences?
>>>>>>>>
>>>>>>>> Personally,  I tend to be rather careless,  using the terms
>>>>>>>> “factor” and “divisor” for the same thing,  when “divisor” is
>>>>>>>> perhaps to be preferred.  However,  Pari GP provides a library
>>>>>>>> function “factor” to deliver the prime factorisation of its
>>>>>>>> argument,  in a similar fashion to J’s q: .
>>>>>>>>
>>>>>>>> So, strictly speaking,  perhaps,  the factors of 358358 are 2 7
>>>>>>>> 11 13 179 and its divisors are 1 2 7 11 13 14 22 etc...
>>>>>>>>
>>>>>>>> You’re both right!
>>>>>>>>
>>>>>>>> Mike
>>>>>>>>
>>>>>>>> Please reply to [email protected].
>>>>>>>> Sent from my iPad
>>>>>>>>
>>>>>>>>> On 3 Nov 2017, at 11:25, Erling Hellenäs
>>>>>>>>> <[email protected]> wrote:
>>>>>>>>>
>>>>>>>>> Hi all!
>>>>>>>>>
>>>>>>>>> Raul:
>>>>>>>>>
>>>>>>>>> "Hmm... actually, thinking about it, the par approach here is
>>>>>>>>> not efficient enough for this example. 5 parRuskeyE 32 is too
>>>>>>>>> big of a result, I think. (358358 has 5 distinct prime factors
>>>>>>>>> and, thus, 32 integer factors.)"
>>>>>>>>>
>>>>>>>>> However there are only 5 integer factors:
>>>>>>>>>
>>>>>>>>>     q: 358358
>>>>>>>>> 2 7 11 13 179
>>>>>>>>>     */q:358358
>>>>>>>>> 358358
>>>>>>>>>
>>>>>>>>> Now you ask me for 44 5 integer factorizations.
>>>>>>>>>
>>>>>>>>> As far as I understand there is only one 5 integer factorization
>>>>>>>>> of 358358 unless you count 1 and 358358 as factors.
>>>>>>>>> In any case it can be handled by parRuskeyE.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Erling Hellenäs
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Den 2017-11-03 kl. 10:58, skrev Raul Miller:
>>>>>>>>>> I'm not sure where you showed the 44 different 5 integer
>>>>>>>>>> factorizations of 358358?
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>> ----------------------------------------------------------------
>>>>>>>>> ------
>>>>>>>>>
>>>>>>>>> For information about J forums see
>>>>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>>
>>>>>>>> -----------------------------------------------------------------
>>>>>>>> -----
>>>>>>>>
>>>>>>>> For information about J forums see
>>>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------
>>>>>>> ----
>>>>>>>
>>>>>>> For information about J forums see
>>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------------------
>>>>>> --- For information about J forums see
>>>>>> http://www.jsoftware.com/forums.htm
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> -- For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> - For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
> ----------------------------------------------------------------------
> 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