Problem 1190. Golomb's self-describing sequence (based on Euler 341)
Solution Stats
Problem Comments
Solution Comments
-
1 Comment
This is a shamless answer,I admit...But the explicit recurrence relation is insanely slow,hope to see you guys solve this problem more efficient.
-
3 Comments
I prefer g(end+1:end+g(gptr))=gptr; to usage of repmat. My machine to solve 1234567 takes 48msec vs 15.4 sec using repmat. repmat has a performance issue with large column replication. Unfortunately score is code size and not time.
totally agree (not to mention the entire 'growing inside a loop' uglyness), cody style is very far from any reasonable coding standard...
That's very interesting. The time difference on my (presumably much older) version of MATLAB is much less. Your method gives me an average time of about 18.8 sec, while repmat gives me an average time of 19.5 sec.
-
2 Comments
May you give a short explanation on this solution?
This is the asymptotic expression of nth term based on the golden ratio. See http://en.wikipedia.org/wiki/Golomb_sequence
Problem Recent Solvers140
Suggested Problems
-
Remove the small words from a list of words.
1167 Solvers
-
Reverse the Words (not letters) of a String
409 Solvers
-
466 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
500 Solvers
-
Find the next Fibonacci number
418 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!