We're on Discord! Please join our server now if you don't want to miss anything! (More info) | Join the UCC4 contest! (More info)

* WalrusIRC & Discord main room

If you have a forum account, have more than 4 posts and are not part of a restricted usergroup, then you can chat in our main Discord server room directly from here and continue using the forums at the same time. Or you can join our server directly and access many more discussion rooms!

Author Topic: OEIS golfing!  (Read 1158 times)

0 Members and 1 Guest are viewing this topic.

Offline Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 3271
  • Post Rating Ratio: +39/-2
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • @juju2143
    • Juju's shed
  • Gender: Female
  • 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 »
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here


You can also use the following HTML or bulletin board code to share it on your page or forum signature!

Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games