Yet another J solution. This one has two functions that mutually recursively build the spiral. This one too accepts the size of the spiral as argument.
spiralh =: (,:@i. , ] + [: |:@|. spirals) ` ((1 0$0)"_) @. (<:&0) spirals =: ,:@i. , ] + [: |:@|. [: spiralh <: spiral =: ([: >: spirals)"0 2!:55[0[ 1!:2&2 spiral 5".>{: ARGV
This is getting addictive, isn't it?
In reply to Re: Spiraling integers
by ambrus
in thread Spiraling integers
by Elijah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |