[Jprogramming] Not so hard to solve the comic in J?

Randy MacDonald ramacd at nbnet.nb.ca
Mon Jan 7 12:48:24 HKT 2008


This is why I test first.  A simple example would have washed out my 
off-by-ones.

Roger Hui wrote:
> No, the expression has to be 1+<.1505%a .
>
> Let k be an element of a.  If k exactly divides 1505
> with a quotient of q, the needed numbers are
> 0 1 2 ... q , in other words i.1+q, in other words
> i.1+<.1505%k .   If k does not exactly divide 1505, 
> the needed numbers are again 0 1 2 ... 1+<.1505%k .
>
>
>
> ----- Original Message -----
> From: Randy MacDonald <ramacd at nbnet.nb.ca>
> Date: Sunday, January 6, 2008 20:04
> Subject: Re: [Jprogramming] Not so hard to solve the comic in J?
> To: Programming forum <programming at jsoftware.com>
>
>   
>> Sorry,
>>
>>  >. 1505 % a
>>
>> Too easy to make a spelling mistake, especially a 1-pixel one.
>>
>> Roger Hui wrote:
>>     
>>> But
>>>    >: 1505 % a
>>> 8 6.47273 5.49254 5.23944 4.58333 3.59483
>>>
>>> and non-integers would lead to errors in later expressions.
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: Randy MacDonald <ramacd at nbnet.nb.ca>
>>> Date: Friday, January 4, 2008 12:10
>>> Subject: Re: [Jprogramming] Not so hard to solve the comic in J?
>>> To: Programming forum <programming at jsoftware.com>
>>>
>>>   
>>>       
>>>> Hello Roger;
>>>>
>>>> n =: >: 1505 % a
>>>>
>>>> If this has been noted, my apologies: I'm doing Xmas catchup.
>>>>
>>>> Roger Hui wrote:
>>>>     
>>>>         
>>>>> The calculation of n was off by 1, and the correction is as 
>>>>>           
>> follows:>>>
>>     
>>>>>    a=: 215 275 335 355 420 580
>>>>>    n=: 1 + <.1505 % a
>>>>>    b=: 1505 = ((#: i.@(*/)) n) +/ .* a
>>>>>    n #: I. b
>>>>> 1 0 0 2 0 1
>>>>> 7 0 0 0 0 0
>>>>>    (n #: I. b) +/ .* a
>>>>> 1505 1505
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: Roger Hui <rhui000 at shaw.ca>
>>>>> Date: Friday, December 21, 2007 13:43
>>>>> Subject: Re: [Jprogramming] Not so hard to solve the comic 
>>>>>           
>> in J?
>>     
>>>>> To: Programming forum <programming at jsoftware.com>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>>    a=: 215 275 335 355 420 580
>>>>>>    n=: <.1505 % a
>>>>>>    b=: 1505 = ((#: i.@(*/)) n) +/ .* a
>>>>>>    n #: I. b
>>>>>> 1 0 0 2 0 1
>>>>>>    1 0 0 2 0 1 +/ .* a
>>>>>> 1505
>>>>>>
>>>>>>
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: Devon McCormick <devonmcc at gmail.com>
>>>>>> Date: Friday, December 21, 2007 13:32
>>>>>> Subject: [Jprogramming] Not so hard to solve the comic in J?
>>>>>> To: J-programming forum <programming at jsoftware.com>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> How hard is it to solve this problem?  http://xkcd.com/287/
>>>>>>>               
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>   

-- 
------------------------------------------------------------------------
|\/| Randy A MacDonald       | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ |                         | The only real problem with APL is that
BSc(Math) UNBF'83            | it is "still ahead of its time."
Sapere Aude                  |     - Morten Kromberg
Natural Born APL'er          |
-----------------------------------------------------(INTP)----{ gnat }-




More information about the Programming mailing list