Talk:Hofstadter Q sequence

Revision as of 06:46, 14 December 2011 by rosettacode>Paddy3118 (→‎<math> not working?: Could someone check?)

Python non-recursive solution

Thanks Ledrug. I had a brain freeze on removing the recursion and blundered on with the accommodation of the recursion limit solution. --Paddy3118 18:34, 23 October 2011 (UTC)

Recursion limit issue

As Ledrug pointed out wrt. to my Dart solution with cache, there is a problem when calling the function with a large number first (e.g. q(100000)) since the cache is filled recursively counting from n to 2 if it is empty (happens with the Java solution for example). This doesn't occur in the calculations necessary to solve the tasks since this way the cache is filled ascending. Maybe the task description should be changed whether it is required to accommodate this. --AlexLehm 09:53, 28 October 2011 (UTC)

I updated the task. The recursive Python solution has a similar issue but with Pythons recursion limit being set at only 1000 by default. The extra credit solution gets around this.
I think that solutions should address such issues in an extendable way if at all possible (not hard-coding something that works just for this tasks value of n). --Paddy3118 14:38, 28 October 2011 (UTC)
My view is: since examples all define Q as a function, it should try its best to ensure the return values don't depend on call history, because that's what one tends to expect. It's best not to (unnecessarily) surprise people. --Ledrug 16:25, 28 October 2011 (UTC)

<math> not working?

The equation in the task description is not being rendered for some reason, even though I don't think it has been edited. Could someone check this? Thanks. --Paddy3118 06:46, 14 December 2011 (UTC)

Return to "Hofstadter Q sequence" page.