I'm not sure if I came up with this or not, 

but a spiral that starts at 0, and initially turns right.  The y argument is 
the square shape of the resulting spiral, so it doesn't end at the top right 
like yours.

(,~ $ |.@/:@(+/\)@(_1&|.@(}:@(2: # >:@i.) # <:@+: $ _1: , ] , 1: , -))) 7

some of the neat properties of this,
squares of even numbers go diagonally up left from 0.  
squares of odd numbers go diagonally down right from 1

That is a very cool video though.  A version of q: that will not fail for 0,

viewmat (#@q: :: 0:)"0 (,~ $ |.@/:@(+/\)@(_1&|.@(}:@(2: # >:@i.) # <:@+: $ _1: 
, ] , 1: , -))) 15

----- Original Message -----
From: Michal Wallace <michal.wall...@gmail.com>
To: programm...@jsoftware.com
Cc: 
Sent: Monday, August 31, 2015 11:09 PM
Subject: [Jprogramming] video: Ulam's Spiral

Hey all,

I made a 15 minute video about a line of J code I wrote a while back:

https://www.youtube.com/watch?v=dBC5vnwf6Zw

-Michal
----------------------------------------------------------------------
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