RosettaCodeData/Task/Hofstadter-Q-sequence/Maple/hofstadter-q-sequence-1.maple
2023-07-01 13:44:08 -04:00

8 lines
221 B
Text

Q := proc( n )
option remember, system;
if n = 1 or n = 2 then
1
else
thisproc( n - thisproc( n - 1 ) ) + thisproc( n - thisproc( n - 2 ) )
end if
end proc: