Talk:Hofstadter Figure-Figure sequences: Difference between revisions
Content added Content deleted
m (→timings for the REXX solutions: removed line break.) |
(→timings for the REXX solutions: updated program and its timing, removed an old spurious timing.) |
||
Line 36: | Line 36: | ||
I decided to go back and include the timings here as the REXX 2<sup>nd</sup> example's timings seemed a bit high. |
I decided to go back and include the timings here as the REXX 2<sup>nd</sup> example's timings seemed a bit high. |
||
<br>I didn't expect a difference of magnitude. |
<br>I didn't expect a difference of three orders of magnitude. |
||
<lang rexx>/*REXX pgm calculates & verifies the Hofstadter Figure-Figure sequences.*/ |
<lang rexx>/*REXX pgm calculates & verifies the Hofstadter Figure-Figure sequences.*/ |
||
call time 'Reset' |
call time 'Reset' |
||
Line 72: | Line 72: | ||
ffs: procedure expose r. s. rr.; parse arg n /*search for ¬null R│S #.*/ |
ffs: procedure expose r. s. rr.; parse arg n /*search for ¬null R│S #.*/ |
||
if s.n==0 then do k=1 for n /* [↓] 1st IF is a short circuit*/ |
if s.n==0 then do k=1 for n /* [↓] 1st IF is a short circuit*/ |
||
if s.k\==0 then |
if s.k\==0 then if r.k\==0 then iterate |
||
call ffr k /*define R.k via FFR subroutine*/ |
|||
km=k-1; _=s.km+1 /*the next S number, possibly. */ |
km=k-1; _=s.km+1 /*the next S number, possibly. */ |
||
_=_+rr._; s.k=_ /*define an element of S array.*/ |
_=_+rr._; s.k=_ /*define an element of S array.*/ |
||
Line 91: | Line 92: | ||
R(9) = 56 S(9) = 13 |
R(9) = 56 S(9) = 13 |
||
R(10) = 69 S(10) = 14 |
R(10) = 69 S(10) = 14 |
||
took 0. |
took 0.22 seconds. |
||
verification completed for all numbers from 1 ──► 1000 [inclusive]. |
verification completed for all numbers from 1 ──► 1000 [inclusive]. |
||
took 1.52 seconds. |
|||
</pre> |
</pre> |
||
The (above) example was run under Windows 7 on a HP box (3.2GHz) using Regina version 3.9.1. |
The (above) example was run under Windows 7 on a HP box (3.2GHz) using Regina version 3.9.1. |