Babbage problem: Difference between revisions

m
→‎{{header|REXX}}: corrected a typo, optimized a couple of versions (to just use even numbers).
(→‎{{header|Ruby}}: Added Ruby)
m (→‎{{header|REXX}}: corrected a typo, optimized a couple of versions (to just use even numbers).)
Line 179:
:* &nbsp; what the &nbsp; <big>'''//'''</big> &nbsp; operator is and what it does division remainder
:* &nbsp; what the &nbsp; '''right''' &nbsp; BIF does
:* &nbsp; what a &nbsp; '''BIF''' &nbsp; is and how it returns a value
:* &nbsp; how/when the &nbsp; '''then''' &nbsp; cause gets executed &nbsp; (after an &nbsp; '''if''')
:* &nbsp; explain how/why an &nbsp; '''end''' &nbsp; statement is needed for the '''do''' loop
Line 187:
<lang rexx>/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
/*operator * is multiplication. */
do j=12 by 12 /*start J at unitytwo, increment by 1two. */
if right(j*j, 6)==269696 then leave /*is six right-most digits our target? */
end /*this signifies the end of the DO loop*/
Line 200:
<lang rexx>/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
/*operator // is division remainder.*/
do j=12 by 12 /*start J at unitytwo, increment by 1two. */
if j*j // 1000000 == 269696 then leave /*is square mod 1-million our target ? */
end /*this signifies the end of the DO loop*/