Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Babbage-problem/REXX/babbage-problem-1.rexx
Normal file
5
Task/Babbage-problem/REXX/babbage-problem-1.rexx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
|
||||
do j=2 by 2 until right(j * j, 6) == 269696 /*start J at two, increment by two. */
|
||||
end /*◄── signifies the end of the DO loop.*/
|
||||
/* [↑] * means multiplication. */
|
||||
say "The smallest integer whose square ends in 269,696 is: " j
|
||||
6
Task/Babbage-problem/REXX/babbage-problem-2.rexx
Normal file
6
Task/Babbage-problem/REXX/babbage-problem-2.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
|
||||
do j=2 by 2 /*start J at two, increment by two. */
|
||||
if ((j * j) // 1000000) == 269696 then leave /*is square mod one million our target?*/
|
||||
end /*◄── signifies the end of the DO loop.*/
|
||||
/* [↑] // is division remainder.*/
|
||||
say "The smallest integer whose square ends in 269,696 is: " j
|
||||
11
Task/Babbage-problem/REXX/babbage-problem-3.rexx
Normal file
11
Task/Babbage-problem/REXX/babbage-problem-3.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*REXX program finds the lowest (positive) integer whose square ends in 269,696. */
|
||||
/*─────────────────── we will only examine integers that are ending in four or six. */
|
||||
do j=4 by 10 /*start J at four, increment by ten.*/
|
||||
k = j /*set K to J's value. */
|
||||
if right(k * k, 6) == 269696 then leave /*examine right-most 6 decimal digits. */
|
||||
/* == means exactly equal to. */
|
||||
k = j+2 /*set K to J+2 value. */
|
||||
if right(k * k, 6) == 269696 then leave /*examine right-most 6 decimal digits. */
|
||||
end /*◄── signifies the end of the DO loop.*/
|
||||
/* [↑] * means multiplication. */
|
||||
say "The smallest integer whose square ends in 269,696 is: " k
|
||||
13
Task/Babbage-problem/REXX/babbage-problem-4.rexx
Normal file
13
Task/Babbage-problem/REXX/babbage-problem-4.rexx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*REXX ----------------------------------------------------------------
|
||||
* The solution must actually be larger than sqrt(269696)=519.585
|
||||
*--------------------------------------------------------------------*/
|
||||
z=0
|
||||
Do i=524 By 10 Until z>0
|
||||
If right(i*i,6)==269696 then z=i
|
||||
Else Do
|
||||
j=i+2
|
||||
if right(j*j,6)==269696 then z=j
|
||||
End
|
||||
End
|
||||
Say "The smallest integer whose square ends in 269696 is:" z
|
||||
Say ' 'z'**2 =' z**2
|
||||
Loading…
Add table
Add a link
Reference in a new issue