20 lines
484 B
Text
20 lines
484 B
Text
/* Hofstrader Q sequence for any "n". */
|
|
|
|
H: procedure options (main); /* 28 January 2012 */
|
|
declare n fixed binary(31);
|
|
|
|
put ('How many values do you want? :');
|
|
get (n);
|
|
|
|
begin;
|
|
declare Q(n) fixed binary (31);
|
|
declare i fixed binary (31);
|
|
|
|
Q(1), Q(2) = 1;
|
|
do i = 1 upthru n;
|
|
if i >= 3 then Q(i) = ( Q(i - Q(i-1)) + Q(i - Q(i-2)) );
|
|
if i <= 20 then put skip list ('n=' || trim(i), Q(i));
|
|
end;
|
|
put skip list ('n=' || trim(i), Q(i));
|
|
end;
|
|
end H;
|