### Author Topic: OEIS golfing!  (Read 1644 times)

0 Members and 1 Guest are viewing this topic.

#### Juju

• aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
• CodeWalrus Staff
• Super User
• Server Maintenance
• Moderator
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Location: Inside a walrus
• Posts: 3290
• Post Rating Ratio: +39/-2
• Couch potato
• Gender:
• WalriiPoints: 99999
##### Re: OEIS golfing!
« on: June 16, 2018, 08:18:55 pm »
Sounds fun. Let's golf every sequence!

JavaScript, A005132, 80 bytes
Code: [Select]
`f=x=>{for(q=[0],s=i=0;i<x;)q[++i]=s+=i*(s-i<=0||!!~q.indexOf(s-i))*2-i;return q}`Defines a function, f, that returns an array of integers. Call it from the console with f(n), with n being your input.

SVG, A005132, 271 267 bytes
Code: [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[i]=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>`Interesting graphic of the above sequence (first 65 steps)

JavaScript (ES6), A001477, 25 bytes
Code: [Select]
`f=x=>[...Array(x).keys()]`Defines a function, f, that returns an array of integers. Call it from the console with f(n), with n being your input.
« Last Edit: June 16, 2018, 10:03:52 pm by Juju »
• Consoles, mobile devices and vintage computers owned: A lot