Hickerson series of almost integers: Difference between revisions

m
→‎version 2: added whitespace, simplified the wording in the REXX section header.
m (→‎version 2: changed height of the output section window.)
m (→‎version 2: added whitespace, simplified the wording in the REXX section header.)
Line 1,806:
===version 2===
This REXX version can calculate the Hickerson series to any number up to the length (in decimal digits)
<br>up to the size &nbsp; (the number of decimal digits) &nbsp; of the number &nbsp; (the number of decimal digits) &nbsp; returned by the &nbsp; '''ln2''' &nbsp; function.
 
This version supports up to &nbsp; '''507''' &nbsp; decimal digits.
<lang rexx>/*REXX program to calculate and show the Hickerson series (are near integer). */
numeric digits length(ln2()) - 1 length(.) /*be able to calculate big factorials. */
parse arg N . /*get optional number of values to use.*/
if N=='' then N=18 1 /*Not specified? Then use the default.*/
/* [↓] compute possible Hickerson #s. */
do j=1 for N; #= Hickerson(j) /*traipse thru a range of Hickerson #s.*/
?= right(# * 10 % 1, 1) /*get 1st decimal digit past dec. point*/
if ?==0 | ?==9 then _= 'almost integer' /*the number is, */
else _= ' ' /* or it ain't. */
say right(j,3) _ format(#, , 5) /*show number with 5 dec digs fraction.*/
end /*j*/
exit /*stick a fork in it, we're all done. */
/*─────────────────────────────────────────────────────────────────────────────────────────────────────────*/
!: procedure; parse arg x; !=1; do j=2 to x; != !*j; end; return ! /* ◄──compute X factorial*/
Hickerson: procedure; parse arg z; return !(z) / (2*ln2() ** (z+1))
ln2: return .69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641,
|| 8687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123,