Joey,
Great that you are learning j by solving problems. If
you want some reading in the j (or APL) way of thinking
about problem 28, you might take a look at:
http://www.vector.org.uk/archive/v144/peelle144_53.htm
- joey
At 16:38 -0800 2007/12/02, Roger Hui wrote:
FYI: Problem 28 in www.ProjectEuler.net is as follows:
Starting with the number 1 and moving to the right in a clockwise
direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of both diagonals is 101.
What is the sum of both diagonals in a 1001 by 1001 spiral formed in
the same way?
----- Original Message -----
From: Joey <[EMAIL PROTECTED]>
Date: Sunday, December 2, 2007 15:43
Subject: Re: [Jprogramming] New to J
To: Programming forum <[email protected]>
Yes, I found [ -(i.4) * ], soo after your post.
I am using that particular code here:
f =: 3 : 'x:+/y -(i.4)*] (%:y)+_1'
1++/f"0 *:>:2*>:i.500
Which is #28 on Project Euler, which I am using to learn J!
I tried f =: 13 : 'x:+/y -(i.4)*] (%:y)+_1', then f; but the
result was
boxed, and I wasn't sure how it should be formatted.
So how can I replace the definiton of f, into 1++/f"0 *:>:2*>:i.500.
> And are there any things I am doing wrong in my code?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm