Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,16 @@
/*REXX pgm tests a number and a range for hailstone (Collatz) sequences.*/
parse arg x .; if x=='' then x=27 /*get the optional first argument*/
$=hailstone(x) /*═════════════task 2════════════*/
#=words($) /*number of numbers in sequence. */
say x 'has a hailstone sequence of' # 'and starts with: ' subword($,1,4),
' and ends with:' subword($,#-3)
say
w=0; do j=1 for 99999 /*═════════════task 3════════════*/
$=hailstone(j); #=words($) /*obtain the hailstone sequence. */
if #<=w then iterate /*Not big 'nuff? Then keep going.*/
bigJ=j; w=# /*remember what # has biggest HS.*/
end /*j*/
say '(between 199,999) ' bigJ 'has the longest hailstone sequence:' w
/*stick a fork in it, we're done.*/