RE: TI-M: Even Square


[Prev][Next][Index][Thread]

RE: TI-M: Even Square



Title: RE: TI-M: Even Square

Hi,

A solution for a TI-92 function (without a loop):

evensq(n)
Func
If ceiling( sqrt(n) )/2 ~= floor( ceiling( sqrt(n) )/2 ) Then
  Return ( ceiling( sqrt(n) ) + 1 )^2
Else
  Return ( ceiling( sqrt(n) ) )^2
EndIf
EndFunc

Note: sqrt : square root
         ~=  : not equal

Regards

Jakob Aabel Østergaard
Project Engineer, M.Sc.E.E.
RTX Telecom A/S
Stroemmen 6
DK-9400 Noerresundby

Phone: +45 96322427
Fax:   +45 96322310