Find square difference: Difference between revisions
m
→{{header|ALGOL 68}}: Corrected comments and typos
m (→{{header|Haskell}}: Trivial edit to a trivial problem) |
m (→{{header|ALGOL 68}}: Corrected comments and typos) |
||
Line 47:
INT required difference = test[ i ];
# n^2 - ( n - 1 )^2 is n^2 - n^2 + 2n - 1, i.e. 2n - 1 #
# so 2n - 1 >
print( ( "Smallest n where n^2 - (n-1)^2 is > ", whole( required difference, -12 )
, " is: ", whole( ( ( required difference + 1 ) OVER 2 ) + 1, -12 )
|