QuickBasic, of course, stops as soon as it tries to take the square root of a negative number, but UBASIC takes it in stride:
list
10 for N=1 to 10000
20 V=sqrt(25/2+sqrt(625/4-N))+sqrt(25/2-sqrt(625/4-N))
30 D=abs(V-int(V))
40 if D>0.99999 or D<0.00001 then print N,V
50 next
60 end
OK
run
144 7.0
784 8.9999999999999999998
2304 10.9999999999999999998
5184 12.9999999999999999998
10000 14.9999999999999999998
OK
Of course the rounding errors lead to those almost-integers that really should be integers.
In each case n is an integer and the result is an integer, so I see nothing wrong with all of them counting as solutions ad infinitum.
|
Posted by Charlie
on 2009-03-20 15:43:58 |