So... watch out here.
A line got split on the space between 4&{ and ::_
When rejoining the line you need to be sure there's a space in your
glued-back-together line. ({:: is syntactically valid, but the wrong
operation in this context.)
Thanks,
--
Raul
On Mon, Dec 4, 2017 at 8:03 AM, Raul Miller <[email protected]> wrote:
> And... speaking of spiral neighbors -- yeah... not paying attention...
> and that looks like an inductive thing...
>
> So...
>
> spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,)
> aspiral=: (*: - spiral)@>.@%:
> coord=: $@] #: I.@,@e.~
>
> steps=:3 :0"0 NB. part 1
> as=. aspiral y
> +/|-/(1,y) coord as
> )
>
> fibspi=:3 :0"0 NB. part 2
> as=. <:aspiral y+25
> seq=. ;(],+/@:{) ::]L:0/|.1; }.(/:,as) {&, _1 _1|.3 3 <@(#~ ] <4&{
> ::_)@,;.3 as
> seq{~(seq <:y)i.0
> )
>
> Beware email induced line wrap (if you see an explicit line which is
> not the last line and which is not an assignment, it's really part of
> the previous line).
>
> Probably can be simplified... and painfully slow.
>
> Now to go back and read whether anyone already posted this and I guess
> try things and see which approaches are faster...
>
> Sorry about the noise,
>
> --
> Raul
>
>
>
> On Mon, Dec 4, 2017 at 7:11 AM, Raul Miller <[email protected]> wrote:
>> Hmmm... actually, my spiral was oriented "wrong" - which doesn't
>> matter, which means that I did not need the |."1 in it...
>>
>> Anyways... looks like I was not paying enough attention...
>>
>> --
>> Raul
>>
>>
>> On Mon, Dec 4, 2017 at 7:05 AM, Raul Miller <[email protected]> wrote:
>>> I used Eugene's approach, also:
>>>
>>> spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,)
>>> aspiral=: (*: - |."1@spiral)@>.@%:
>>> steps=:3 :0"0
>>> as=. aspiral y
>>> +/|-/(($as)#:I.,1=as),($as)#:I.,y=as
>>> )
>>>
>>> steps 1 12 23 1024
>>> 0 3 2 31
>>>
>>> FYI,
>>>
>>> --
>>> Raul
>>>
>>> On Mon, Dec 4, 2017 at 2:02 AM, Brian Schott <[email protected]> wrote:
>>>> I have only worked on part 1 so far.
>>>> All my verbs are monadic and take the number in question as its argument.
>>>>
>>>>
>>>> evenQ =. = <.&.-:
>>>> size =. (+evenQ)@>.@%: NB. edge length
>>>> border =. size-&*:_2+size NB. border length (number)
>>>> lowest =. 1 _3 4& p. @ -:@<:@size NB. border's number which needs
>>>> lowest # of moves
>>>> least4 =. lowest+ (i. 4)*4%~border NB. border's 4 lowest # of moves
>>>> least =. -:@<:@size NB. least # of moves
>>>> addto =: least4<./@:(|@-)] NB. additional # of moves
>>>> total =. least + addto
>>>> total"0]1 12 23 1024
>>>> 0 3 2 31
>>>>
>>>> I found the polynomial in `lowest` by studying the pattern of numbers 1 2
>>>> 11 28 53
>>>> as follows. (The fact that the 2nd differences are constantly 8 lead me to
>>>> the
>>>> solution.)
>>>>
>>>> 2-/\(^: 0 1 2)1 _3 4 p. i. 5
>>>> 1 2 11 28 53
>>>> _1 _9 _17 _25 0
>>>> 8 8 8 0 0
>>>>
>>>>
>>>> I had seen Eugene's evolute and now WRAP, so maybe the second part is
>>>> doable, but I'm tired.
>>>>
>>>> --
>>>> (B=) <-----my sig
>>>> Brian Schott
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm