CodeWalrus

General => Tech, Science, IT discussion & News => Topic started by: Yuki on June 15, 2018, 01:55:44 AM

Title: The Recamán Sequence (Code Golf)
Post by: Yuki on June 15, 2018, 01:55:44 AM
The Recamán Sequence is probably one of the most fascinating sequences in maths. It looks good, it sounds good too. Full explanation in the video below.

https://www.youtube.com/watch?v=FGC5TdIiT9U

The image featured in this video in particular, it looks pretty cool so I reproduced it in about 335 277 274 bytes.

Code (svg) Select
<svg xmlns="http://www.w3.org/2000/svg"><path id="p" stroke="#000" fill="none"/><script>/*<![CDATA[*/q=[];a="M2,325";for(s=i=0;i<65;)c=s-++i<=0||!!~q.indexOf(s-i),q.push(s+=j=i*c*2-i),a+="a1,1 0 0,"+(i%2^c)+" "+j+"0,0";document.all[1].setAttribute("d",a)//]]></script></svg>

Check this out!



Can you do better?
Title: Re: The Recamán Sequence (Code Golf)
Post by: _iPhoenix_ on June 16, 2018, 10:37:16 AM
Your code does not work for me (latest version of chrome, Mac); what browser are you using?
Title: Re: The Recamán Sequence (Code Golf)
Post by: Yuki on June 16, 2018, 06:39:55 PM
I use Vivaldi for Mac. So pretty much the same as you. And it works for me... weird. What did you do?