Find square difference: Difference between revisions

Content added Content deleted
(J)
Line 353: Line 353:
Through inspection, we can see that the "square difference' for a number <code>n</code> is <code>(2*n)-1</code>:
Through inspection, we can see that the "square difference' for a number <code>n</code> is <code>(2*n)-1</code>:
<syntaxhighlight lang=J> (*: - *:&<:) 1 2 3 4 5
<syntaxhighlight lang=J> (*: - *:&<:) 1 2 3 4 5
1 3 5 7 9</code>
1 3 5 7 9</syntaxhighlight>


Therefore, we expect that n=501 would give us a "square difference' of 1001. Testing, we can see that this is the case:
Therefore, we expect that n=501 would give us a "square difference' of 1001. Testing, we can see that this is the case: