HP15C (11C/34C/42S/etc) Arguably Useful MiniChallenge Message #1 Posted by Valentin Albillo on 24 Nov 2003, 11:16 a.m.
Hi all,
After some months of comforting absence, here's a new Arguably Useful MiniChallenge
for the HP15C.You can also use other HP models such as the
HP11C, HP34C, HP42S, etc, though my solutions and timing will be particularized explicitly for the HP15C.
The challenge has practical applications, and goes like this:
The Challenge
Write a subroutine (LBL A ... RTN) that given an integer N (where N > 0) in the display,
it will return to the display the value of f(N), where:
f(N) = 1 x 3 x 5 x ... x (2*N3) x (2*N1)
< N terms >
thus, for instance, if N = 4 then
f(4) = 1 x 3 x 5 x 7 = 105
The main design goal for the routine is for it to be
as fast as possible, (specially
for large N, such as N > 30) and subject to that, to be
as short as possible, to minimize resources (registers,
flags, etc) used or have some other desirable properties.
Under the conditions given, there's a solution for the HP15C in just 12 steps
(counting LBL A and RTN) which takes 2.7 seconds for N = 52.
I'll give my solutions within 2 days or so, discussing the
relative advantages of each. Meanwhile, let's see what
you can do with your trusty HP and your ingenuity. :)
Best regards from V.
Edited: 24 Nov 2003, 11:23 a.m.
