# One OEIS after another

As of 13/03/2018 16:45 UTC, the winner is answer #345, by Scrooble. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the rules.

As well, just a quick shout out to the top three answerers in terms of numbers of answers:

3. Hyper Neutrino - 26 answers

This is an answer chaining question that uses sequences from OEIS, and the length of the previous submission.

This answer chaining question will work in the following way:

• I will post the first answer. All other solutions must stem from that.
• The next user (let's call them userA) will find the OEIS sequence in which its index number (see below) is the same as the length of my code.
• Using the sequence, they must then code, in an unused language, a program that takes an integer as input, n, and outputs the nth number in that sequence.
• Next, they post their solution after mine, and a new user (userB) must repeat the same thing.

The nth term of a sequence is the term n times after the first, working with the first value being the first value given on its OEIS page. In this question, we will use 0-indexing for these sequences. For example, with A000242 and n = 3, the correct result would be 25.

## However!

This is not a , so shortest code doesn't matter. But the length of your code does still have an impact. To prevent the duplication of sequences, your bytecount must be unique. This means that no other program submitted here can be the same length in bytes as yours.

If there isn't a sequence for then length of the last post, then the sequence for your post is the lowest unused sequence. This means that the sequences used also have to be unique, and that the sequence cannot be the same as your bytecount.

After an answer has been posted and no new answers have been posted for more than a week, the answer before the last posted (the one who didn't break the chain) will win.

## Input and Output

Generic input and output rules apply. Input must be an integer or a string representation of an integer and output must be the correct value in the sequence.

## Formatting

# N. language, length, [sequence](link)

code

*anything else*


## Rules

• You must wait for at least 1 hour before posting an answer, after having posted.
• You may not post twice (or more) in a row.
• The index number of a sequence is the number after the A part, and with leading zeros removed (e.g. for A000040 the index number is 40)
• You can assume that neither the input nor the required output will be outside your languages numerical range, but please don't abuse this by choosing a language that can only use the number 1, for example.
• If the length of your submission is greater than 65536 characters long, please provide a link to a way to access the code (pastebin for example).
• n will never be larger than 1000, or be out of bounds for the sequence, simply to prevent accuracy discrepancies from stopping a language from competing.
• Every 150 (valid) answers, the number of times a language may be used increases. So after 150 solutions have been posted, every language may be used twice (with all previous answers counting towards this). For instance, when 150 answers have been posted, Python 3 may be used twice, but due to the fact that it has already been used once, this means it can only be used once more until 300 answers have been posted.
• Please be helpful and post a link to the next sequence to be used. This isn't required, but is a recommendation.
• Different versions of languages, e.g. Python 2 and Python 3 are different languages. As a general rule, if the different versions are both available on Try It Online, they are different languages, but keep in mind that this is a general rule and not a rigid answer.
• It is not banned, but please try not to copy the code from the OEIS page, and actually try to solve it.
• Hardcoding is only allowed if the sequence is finite. Please note that the answer that prompted this (#40) is the exception to the rule. A few answers early in the chain hardcode, but these can be ignored, as there is no good in deleting the chain up to, say, #100.

var QUESTION_ID=133754,OVERRIDE_USER=66833;function shareUrl(i){return"https://codegolf.stackexchange.com/a/"+i}function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getTemplate(s){return jQuery(jQuery("#answer-template").html().replace("{{PLACE}}",s.index+".").replace("{{NAME}}",s.user).replace("{{LANGUAGE}}",s.language).replace("{{SEQUENCE}}",s.sequence).replace("{{SIZE}}",s.size).replace("{{LINK}}",s.link))}function search(l,q){m=jQuery("<tbody id='answers'></tbody>");e.forEach(function(s){if(!q||(l==0&&RegExp('^'+q,'i').exec(s.lang_name))||(l==1&&q===''+s.size)){m.append(jQuery(getTemplate(s)))}});jQuery("#answers").remove();jQuery(".answer-list").append(m)}function sortby(ix){t=document.querySelector('#answers');_els=t.querySelectorAll('tr');els=[];for(var i=0;i<_els.length;i++){els.push(_els[i]);}els.sortBy(function(a){a=a.cells[ix].innerText;return ix==0||ix==4?Number(a):a.toLowerCase()});for(var i=0;i<els.length;i++)t.appendChild(els[i]);}function checkSize(x){if(!x)return jQuery("#size-used").text("");var i=b.indexOf(+x);if(i<0)return jQuery("#size-used").text("Available!");var low=+x,high=+x;while(~b.indexOf(low))low--;while(~b.indexOf(high))high++;jQuery("#size-used").text(("Not available. The nearest are "+low+" and "+high).replace("are 0 and","is"))}function checkLang(x){}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.answer_id;answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return (e.owner.user_id==OVERRIDE_USER?"<span id='question-author'>"+e.owner.display_name+"</span>":e.owner.display_name)}function process(){b=[];c=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);if(a){e.push({user:getAuthorName(s),size:+a[4],language:a[2],lang_name:a[3],index:+a[1],sequence:a[5],link:shareUrl(s.answer_id)});if(b.indexOf(+a[4])>=0&&c.indexOf(+a[4])<0){c.push(+a[4])};b.push(+a[4])}else{jQuery('#weird-answers').append('<a href="'+shareUrl(s.answer_id)+'">This answer</a> is not formatted correctly. <b>Do not trust the information provided by this snippet until this message disappears.</b><br />')}}),e.sortBy(function(e){return e.index});e.forEach(function(e){jQuery("#answers").append(getTemplate(e))});var q="A"+("000000"+e.slice(-1)[0].size).slice(-6);jQuery("#next").html("<a href='http://oeis.org/"+q+"'>"+q+"</a>");c.forEach(function(n){jQuery('#weird-answers').append('The bytecount '+n+' was used more than once!<br />')})}Array.prototype.sortBy=function(f){return this.sort(function(a,b){if(f)a=f(a),b=f(b);return(a>b)-(a<b)})};var ANSWER_FILTER="!*RB.h_b*K(IAWbmRBLe",COMMENT_FILTER="!owfmI7e3fd9oB",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page,e=[];getAnswers();var SCORE_REG=/<h\d>\s*(\d+)\.\s*((?:<a [^>]+>\s*)?((?:[^\n,](?!<\/a>))*[^\s,])(?:<\/a>)?),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*, ((?:<a[^>]+>\s*)?A\d+(?:\s*<\/a>)?)\s*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important;font-family:Roboto,sans-serif}#answer-list,#language-list{padding:10px;/*width:290px*/;float:left;display:flex;flex-wrap:wrap;list-style:none;}table thead{font-weight:700}table td{padding:5px}ul{margin:0px}#board{display:flex;flex-direction:column;}#language-list li{padding:2px 5px;}#langs-tit{margin-bottom:5px}#byte-counts{display:block;margin-left:15px;}#question-author{color:purple;text-shadow: 0 0 15px rgba(128,0,128,0.1);}#label-info{font-weight: normal;font-size: 14px;font-style: italic;color: dimgray;padding-left: 10px;vertical-align: middle; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><p id="weird-answers"></p><p>Currently waiting on <span id="next"></span></p><span>Search by Byte Count: <input id="search" type="number" min=1 oninput="checkSize(this.value);search(1,this.value)" onclick="document.getElementById('search2').value='';!this.value&&search(0,'')"/> <span id="size-used"></span></span><br><span>Search by Language: <input id="search2" oninput="checkLang(this.value);search(0,this.value)" onclick="document.getElementById('search').value='';!this.value&&search(0,'')"/> <span id="language-used"></span></span><h2>Answer chain <span id="label-info">click a label to sort by column</span></h2><table class="answer-list"><thead><tr><td  onclick="sortby(0)">#</td><td onclick="sortby(1)">Author</td><td onclick="sortby(2)">Language</td><td onclick="sortby(3)">Sequence</td><td onclick="sortby(4)">Size</td></tr></thead><tbody id="answers"></tbody></table><table style="display: none"><tbody id="answer-template"><tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SEQUENCE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table><table style="display: none"><tbody id="language-template"><tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SEQUENCE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table>

• Comments are not for extended discussion; this conversation has been moved to chat. – Dennis Oct 31 '17 at 2:49
• Is it OK if a program would need a better floating-point accuracy for the builtin float/double type in order to produce values for larger n? – NieDzejkob Nov 21 '17 at 15:15
• @Giuseppe No, as you're generating the numbers by doing the maths, rather than just placing them into an array/string – caird coinheringaahing Dec 15 '17 at 22:14
• @cairdcoinheringaahing In my opinion that's hardcoding the gamma constant. It doesn't work "in theory" for larger numbers. – user202729 Dec 22 '17 at 12:44
• Chat room – user202729 Dec 22 '17 at 12:45

# 314. M, 4166 bytes, A000146

I hope I didn’t accidentally add any bytes outside of the M code page in the code.

The actual source code is the markdown source of this post. To prevent infinite recursion, the source can be found here.

Try it online! (with anti-infinite-recursion)

Next sequence!

## Explanation

® ÆD ‘ ÆPÐf İ           ḷ“   First link. Calculate Sum_{(p-1)|2n} 1/p, with
the value of 2n stored in the register.
® ÆD                         All divisors of 2n (possible values of (p-1).
‘                  ḷ“   Increment. Get all possible values of (p).
ÆPÐf                  Filter, keep only prime values.
İ                Inverse.       ”
-* ×c@ × *®¥            ḷ“   Second (dyadic) link. Given v and k, calculate
(-1)^v * (k choose v) * v^m / (k+1). (m = 2*n),
a term from the closed-form formula.
-                            Literal -1.
*                           Power. Current value = (-1)^v.
×c@                       Multiply (×) by the combination (c) with swapped (@)
arguments applied on k and v.
× *®¥                 Multiply by the value of dyad applied on v...
*                     Raise to power...
®                    register value (currently have value m = 2n)   ”
‘                          ḷ“ Increment.
Ḥ©                          Unhalve (double) the value, and store to register.
0r                       Generate range from 0.
µ........µ€           For each value (k),
0r                     generate range from 0 (values (v)),
ç€                  apply previous range for each element,
÷‘          ḷ“   and divide by (k+1).
;-£       Concatenate the resulting list with the value of
FS     Flatten, and sum.         ”

• Another bignum sequence... this one is easy enough, please don't use Hy. (or another-Python-variant) – user202729 Jan 17 '18 at 8:13
• I think you should edit in an explanation of how the polyglot works ;) – NieDzejkob Jan 17 '18 at 14:06
• This answer broke the snippet, but I will nudge the regex used to make it work. – NieDzejkob Jan 17 '18 at 14:30
• Is M just an early version/precursor of Jelly? – dylnan Jan 17 '18 at 21:34
• @dylnan Numerical inaccuracy. This also works (adding ceiling will make the difference more explicit). – user202729 Jan 18 '18 at 4:13

# 315. Befunge-98 (PyFunge), 147 bytes, A004166

very simple :)
>"HTRF"4(1&>:!#v_1v <-- this loop here
@.$<--out^\*3 \-< <-- calculates 3^n >;#_^#:/a\+%aO<\;#z<-- and here the digits are summed  Try it online! Next sequence! • dagnabbit, I had a snobol solution all ready, I was just testing it :( here it is, looks like it's correct. – Giuseppe Jan 17 '18 at 15:45 • @Giuseppe well, I got ninjad on the previous sequence - I was working on a Trefunge solution and I had the Bernoulli numbers working, I just had to add the reciprocals of prime divisors. – NieDzejkob Jan 17 '18 at 16:13 • Again, a trailing newline is necessary. So v = ↓... – user202729 Jan 18 '18 at 4:17 • Looks like I have to post the next answer. 38 hours left. – user202729 Jan 23 '18 at 1:38 # 332. tinylisp, 852 bytes, A000766 (d in (q ((x xs) (i (e x (h xs)) 1 (i xs (in x (t xs)) 0 (d vec (q ((x y z) (c x (c y (c z ( (d + (q ((x y) (i x (c (a (h x) (h y)) (+ (t x) (t y))) ( (d map (q ((f xs) (i xs (c (f (h xs)) (map f (t xs))) ( (d sub (q ((exp pat rep) (i (e exp pat) rep (i (e (type exp) (q List)) (i exp (c (sub (h exp) pat rep) (sub (t exp) pat rep)) ()) exp (d qt (q ((x) (c (q q) (c x ( (d - (s 0 1 (d adj (c (vec 1 1 0) (c (vec - 1 0) (c (vec 1 - 0) (c (vec - - 0) (c (vec 1 0 1) (c (vec - 0 1) (c (vec 1 0 -) (c (vec - 0 -) (c (vec 0 1 1) (c (vec 0 - 1) (c (vec 0 1 -) (c (vec 0 - -) ( (d sum (q ((ls) (i ls (a (h ls) (sum (t ls))) 0 (d sol (q ((ve pre n) (i (in ve pre) 0 (i n (sum (map (sub (sub (sub (q ((aj) (sol (+ VEC aj) PRE N))) (q VEC) (qt ve)) (q PRE) (qt (c ve pre))) (q N) (qt (s n 1))) adj)) (e (h ve) 1 (d main (q ((x) (sol (vec 0 0 0) () (a 1 x  Try it online! Next sequence! Intentionally chosen to be easy. (somewhat weird, too) ... It was (not) fun learning this language. Defines a function main which calculates the required function. tinylisp doesn't support reading from standard input. Brute force approach. That's why it's terribly slow. ... There is library to load? In an esoteric language? Surprise! • No line has a trailing ). – user202729 Feb 10 '18 at 15:25 • Hey, thanks for using my language. :) Sorry your learning experience was painful... If you have suggestions on how I can make tinylisp more approachable, I'd love to hear them! (Chat room here) – DLosc Feb 10 '18 at 19:03 # 344. Proton, 301 bytes, A000382 p = a => { if len(a) == 1 return [a] values = [] for i : 0 .. len(a) for j : p(a[to i] + a[i + 1 to]) values.append([a[i]] + j) return values } a = n => { total = 0 n += 4 for j : p(0 .. n) if all((j[i] - i) % n < 4 for i : 0 .. n) total++ return total } print(a(int(input())) / 4)  Try it online! Next sequence. This code takes a long time on n = 2 and I don't want to try testing it on larger cases :P In theory, it works for all cases; the code is an exact implementation of the sequence description, so no fancy math stuff that could break. Inefficient Coding 101 with Hyper Neutrino \o/ (this is intentionally posted from my bot account. someone downvoted one of my posts and now I only have 19 reputation, which isn't enough to chat. and also I'm not going to go upvote it with my main account because that's evil, so I'm making a new post to earn some reputation, hopefully) • does it count as chaining myself if I use a different account LOL (obviously yes) – HyperNeutrino Feb 28 '18 at 2:10 • The next sequence should be rather easy; ÆḞ2* should work in Jelly. – HyperNeutrino Feb 28 '18 at 2:13 # 48. SOGL, 3 bytes, A000194 .√Ρ  Next sequence • @cairdcoinheringaahing There's no way I can't solve it in 2 days – Leaky Nun Jul 22 '17 at 14:20 • @cairdcoinheringaahing you don't need to worry about not solving it until a couple days have passed :P – Stephen Jul 22 '17 at 14:37 # 53. Coffeescript, 34 bytes, A000484 alert Math.round Math.cos prompt()  Try it online! Next sequence • @StepHen The next one is super easy too – BlackCap Jul 22 '17 at 16:26 • Man, the next one is so easy, too bad I can't post yet... This would be ....I2%:)O@ in Cubix (could be shorter but 9 and 10 are already taken) – ETHproductions Jul 22 '17 at 16:26 • @BlackCap yup I got it in :P – Stephen Jul 22 '17 at 16:28 # 54. C# (.NET Core), 196 bytes, A000034 using System; namespace A000008 { class Program { static void Main(string[] args) { Console.WriteLine(1 + Int32.Parse(Console.ReadLine()) % 2); } } }  Try it online! Next Sequence • lol the next one literally has a builtin in Jelly xD – HyperNeutrino Jul 22 '17 at 16:32 # 60. Oasis, 5 + 2 = 7 bytes, A000059 +2 bytes for the N and o flags. ### Code: x4m>p  Try it online! ### Explanation: x # Double the number 4m # Raise to the power of 4 > # Add one p # Check for primality  Used with the following flags: • N: Find the Nth number that satisfies each line of code • o: Shift the sequence by 1 (N = N + 1). Next sequence • Can't believe that we haven't had A7 – Leaky Nun Jul 22 '17 at 20:00 # 61. √ å ı ¥ ® Ï Ø ¿, 5 bytes, A000007 I0^o  Next sequence # 64. LiveScript, 152 bytes, A000108 f = (n) -> ns = [1] for i from 0 to n-1 ns.push 0 s = 0 for k from 0 to ns.length-1 s += ns[k] ns[k] = s ns[ns.length-1]  Try it online! Next sequence • Great, I don't even understand how 2 becomes 32 in this one – ETHproductions Jul 22 '17 at 23:21 • @ETHproductions Would you rather have had A151? – BlackCap Jul 22 '17 at 23:22 • ...no, sorry to complain :P You could have golfed it though – ETHproductions Jul 22 '17 at 23:29 • Oh, it's 0-indexed. That makes more sense I suppose – ETHproductions Jul 22 '17 at 23:33 • @WheatWizard You have to account for -1s as well though, hence why 1 is 32 as opposed to 16. – ETHproductions Jul 22 '17 at 23:57 # 65. Fortran (GFortran), 371 bytes, A000152 function A000152(n) integer :: n, i, a, sum, index, A000152 integer, dimension(n+1) :: gf gf(1) = 1 do i=2,n+1 gf(i) = 0 end do do a=1,16 do i=n+1,2,-1 sum = 0 index = 1 do while (index * index < i) sum = sum + 2 * gf(i - index * index) index = index + 1 end do gf(i) = gf(i) + sum end do end do A000152 = gf(n+1) end function A000152  Try it online! Next sequence ## How it works It uses the following gf: (sum(m=[-infty,infty], x^(m^2)))^16  # 66. Yacas, 43 bytes, A000371 f(n):=Sum(k,0,n,(-1)^(n-k)*Bin(n,k)*2^2^k);  Try it online! Next sequence # 56. Pony, 138 bytes, A000041 fun f(n: U64, q: U64 = 1): U64 => if n>0 then if n>=q then f(n-q, q)+f(n,q+1) else 0 end else 1 end //a  Try it online! (Thank you for adding Pony Dennis!) Next sequence • Try this: playground.ponylang.org – Stephen Jul 22 '17 at 17:58 • I add most languages by request. Assuming this is one, I'll look into Pony. – Dennis Jul 22 '17 at 18:05 • @StepHen Thanks, that worked. – BlackCap Jul 22 '17 at 18:11 • @Dennis Thank you, I appreciate that – BlackCap Jul 22 '17 at 18:59 • One Pony, as requested. In the future, if you find a language you'd like to see added to TIO, please don't hesitate to leave me a message in talk.tryitonline.net. – Dennis Jul 23 '17 at 5:44 # 70. Elm, 1134 bytes, A000333 import Html exposing (text) f n s = let l = takeWhile (\x -> (s + sqrt (toFloat x)) <= n) (List.range 1 (floor (n*n))) in List.map (\x -> [x]) l ++ (List.concatMap (\x -> List.map (\y -> x::y) ( f n (s+sqrt (toFloat x)) )) l) t n = List.length(List.map List.head(group(List.sort(List.map List.sort(f(n+1)0))))) main = text (toString (List.length (t 5))) takeWhile : (a -> Bool) -> List a -> List a takeWhile predicate list = case list of [] -> [] x::xs -> if (predicate x) then x :: takeWhile predicate xs else [] dropWhile : (a -> Bool) -> List a -> List a dropWhile predicate list = case list of [] -> [] x::xs -> if (predicate x) then dropWhile predicate xs else list span : (a -> Bool) -> List a -> (List a, List a) span p xs = (takeWhile p xs, dropWhile p xs) groupBy : (a -> a -> Bool) -> List a -> List (List a) groupBy eq zs = case zs of [] -> [] (x::xs) -> let (ys,zs) = span (eq x) xs in (x::ys)::groupBy eq zs group : List a -> List (List a) group = groupBy (==)  This is much prettier in Haskell, but it has been used. Try it online! Next sequence • but it has been used. by you :P – Stephen Jul 23 '17 at 20:35 # 71. F# (Mono), 401 bytes, A001134 That was quite an experience, using a language I've never tried before which is based on a bunch of programming paradigms I've never experienced before... let isprime p = let mutable q = 2 while q * q < p && p % q > 0 do q <- q + 1 p >= 2 && q * q > p let isA001134 p = let mutable i = 1 let mutable g = 2 while g <> 1 do g <- g * 2 % p i <- i + 1 i * 4 = p - 1 && isprime p let A001134 n = let mutable q = n let mutable result = 113 while q > 0 do result <- result + 4 if isA001134 result then q <- q - 1 result  Try it online! Next sequence # 77. Braingolf, 51 bytes, A004147 m32&gM9784&gM7571840&gM11140566368&gMvvcv1+[R<v]v_;  Try it online! Next sequence • According to this answer, the number of 5-state Turing machines which halt is 32. :p And then it just keeps cycling through the same four numbers – Peter Olson Jul 24 '17 at 16:49 • @PeterOlson actually according to this answer the number of 4-state halting machines is 32, but it's irrelevant because the numbers are incomputable, and unknown beyond n=3 – Skidsdev Jul 24 '17 at 18:11 # 78. anyfix, 12 bytes, A000051  2«*‘  Try it online! Next Sequence Note: TIO says 15 bytes but that's because I haven't asked Dennis to configure Anyfix to use the Jelly codepage yet. # 79. Commentator, 13 bytes, A000012  */  Try it online! Next Sequence A space increments the accumulator and */ outputs it as a number. As the program has outputted, the spaces at the end are essentially no-ops. # 86. Gaia, 40 bytes, A00097 1w×ḍΣ¦¦ȯ¦u⟨:l0₁,*¤⟪¤;3<×\?⟫†¦ȯ¦u⟩¦e¦l:!+  Next sequence # 87. Neim, 16 bytes, A000040 >𝐋1𝕗><><><><><><  Output is wrapped in braces []. Yes, those are random filler bytes (that increment and decrement continuously), but I like to think of them as fish having fun with code. Try it online! Next sequence. • i don't know, I think it looks like a fish double date ><><>< ><><>< – BlackCap Jul 25 '17 at 14:49 • You can replace 1𝕗 (get last 1 elements) with 𝐠 (get greatest element) if you want output without braces. Also, you can use Q as a filler (terminate program) or a space character. – Okx Jul 26 '17 at 11:41 • @Okx Why do you want no fish dates? – NieDzejkob Sep 5 '17 at 5:24 # 90. Open Shading Language (OSL), 66 bytes, A000201 shader abc(int i=1, output float o=1){o=floor(i*((1+sqrt(5))/2));}  Next Sequence # 93. Clojure, 35 bytes, A000093 #(Math/floor (Math/sqrt (* % % %)))  Try it online! Next Sequence # 98. Befunge-98 (PyFunge), 153 bytes, A001772 &v >1 >1+:00g\%kvv>1\>1-\2*\:kvv # vw\-1g00: < >$v ^       < $>0p^ >$01g1-:01v> #> > 1+vv-1*b<
^>1+01p         ^ ^:     <>0
>p  k^.@zz


Try it online! The two zs after the @ are nop's that never get executed but I added in the make the bytecount correspond to an easier sequence. Becuase of what I think is a quirk of the interpreter and the fact that TIO doesn't provide a trailing newline, input needs to be given with a trailing space.

Next sequence

# 100. Pyke, 20 bytes, A000030

                  h


Try it online!

Next Sequence.

• @StepHen EDIT Sorry, fixing – Mr. Xcoder Aug 11 '17 at 19:27
• @StepHen How is this 1-indexed? Inputting 0 gives 0 as it should – Business Cat Aug 11 '17 at 19:27
• @StepHen Fixed, haha – Mr. Xcoder Aug 11 '17 at 19:28

# 110. Nim, 442 bytes, A000081

from strutils import parseint
import math

proc A000081(index: int): int =
if index <= 0: return 0
elif index <= 2: return 1
elif index == 3: return 2
elif index == 4: return 4
else:
var n: int = index - 1
result = 0
for k in 1..n:
var t: int = 0
for d in 1..k:
if gcd(d,k)==d:
t = t + (d * A000081(d))
result = result + t*A000081(n-k+1)
result = int(result / n)
return



Try it online!

Next sequence

# 113. Arcyóu, 228 bytes, A000049

(: grp (F(d) d))
(: q (# (q)))
(: t (? q (]
(r * (* (_ 2 3) q))) 2))
(: a 0)
(f x (_ 1 t) (grp
(: b 0)
(f y (_ t) (grp
(f z (_ t) (grp
(? (= (+ (* 3 (* y y)) (* 4 (* z z))) x) (: b 1) 1)
))
))
(: a (+ a b))
))
(p a)


This is slow for terms past about the fifth, but Arcyóu is implemented in Python, which does support arbitrary precision numbers. Try it online!

Next sequence (let's try some geometry ...)

• The next one ought to be done in Hexagony. – KSmarts Aug 16 '17 at 15:41
• why do you keep doing hard next-sequences ;_; xD – HyperNeutrino Aug 16 '17 at 20:09
• Because I think this challenge is progressing too fast. Actually, this is only my second hard sequence, and the first one was accidental; I didn't realize it was going to be hard. – pppery Aug 16 '17 at 21:18
• I managed to decypher the name, I believe. It's about thr number of different "tetrominoes" with n pieces, but on a hexagonal grid. Read Polyhex on Wikipedia. – NieDzejkob Aug 17 '17 at 1:58
• @NieDzejkob Your link was 404 – HyperNeutrino Aug 17 '17 at 15:26

# 122. MIT/GNU Scheme, 2057 bytes, A000525

So I'm implementing A000081 again...

(define (add f g)
(stream-map + f g) )

(define (scale c f)
(stream-map (lambda (v) (* c v)) f) )

(let ((f0 (stream-first sf)))
(cons-stream (stream-first f0)

(define (mult f g)
(adddiag (stream-map (lambda (v) (scale v g)) f)) )

(define (prependzeros n f)
(if (= 0 n) f (cons-stream 0 (prependzeros (-1+ n) f))) )

(define (intersperse f n)
(cons-stream (stream-first f)
(prependzeros n (intersperse (stream-rest f) n)) ) )

(define (iterate fun init)
(cons-stream init (iterate fun (fun init))) )

(define (from n)
(cons-stream n (from (1+ n))) )

(define (scanl fun init s)
(cons-stream init (scanl fun (fun init (stream-first s)) (stream-rest s))) )

(define (expx f)
(cons-stream 1
(adddiag (stream-map (lambda (s g) (scale (/ 1 s) g))
(scanl * 1 (from 2))
(iterate (lambda (g) (mult f g)) f) )) ) )

(define (eu f)
(expx (adddiag (stream-map (lambda (n) (scale (/ 1 n)
(intersperse f (-1+ n)) ))
(from 1) ))) )

(define gf000081s (cons-stream 1 (stream-rest (eu gf000081s))))

(define gf000081 (cons-stream 0 gf000081s))

(define (recip1 f)
(let ((msf (scale -1 (stream-rest f))))
(cons-stream 1 (adddiag (iterate (lambda (g) (mult msf g)) msf))) ) )

(define (div1 f g)
(mult f (recip1 g)) )

(define (pow7 f)
(let* ((p2 (mult f f))
(p4 (mult p2 p2))
(p6 (mult p4 p2)) )
(mult p6 f) ) )

(cons-stream (+ c (stream-first f))
(stream-rest f) ) )

(define gf
(let* ((p2 (mult gf000081 gf000081))
(p3 (mult p2 gf000081))
(p4 (mult p3 gf000081)) )
(scale  36 p2) )
(scale -6 p3) ) ))
(pow7 (addconst 1 (scale -1 gf000081))) ) ) )

(define (f n) (stream-ref gf (+ 4 n)))


In debian, MIT/GNU Scheme is in the package mit-scheme.

Here's how to use it when the program is in a file ps.scm:

\$ scheme --load ps.scm
MIT/GNU Scheme running under GNU/Linux
[...]
1 ]=> (f 20)

;Value: 90039381031273


Next sequence

• Man, I wanted to do this one. I mean, I implemented A000081 first... – KSmarts Sep 1 '17 at 15:38
• Sorry, I thought I had waited long enough... – Christian Sievers Sep 1 '17 at 16:46

# 130. TI-Nspire CAS Basic, 90 bytes, A000482

Define f(n)=
Prgm
:Disp polyCoeffs(taylor((−ln(1-x))^(5),x,n),x)[1]*((n!)/(5!))
:EndPrgm


Next Sequence

Code in Action

Fun fact: I tried to implement 3 other sequences, but was too late as other answers had been made

• Pretty straightforward implementation from Oeis page, also hooray for first actual answer – Husnain Raza Sep 2 '17 at 19:16
• Also next sequence has closed form :o – Husnain Raza Sep 2 '17 at 20:18
• I know that feeling. I tried to implement 2 sequences, only the third got through. – NieDzejkob Sep 2 '17 at 20:32
• Next sequence is pretty straightforward – Husnain Raza Sep 2 '17 at 20:36
• Yeah, fractional factorials will take a while to figure out. – NieDzejkob Sep 2 '17 at 20:38

# 148. Python 2 (IronPython), 173 bytes, A000695

def to_b_4(k):
r=""
while k>0:
r=k%4+r
k //=4
return r
n=input()
i=j=b=0
while i<=n:
b=set(to_b_4(j))
if not("2"in b or"3"in b or"4"in b):
i+=1
j+=1
print(j-1)


Try it online!

Next Sequence

• I'll tackle this with OCaml... – NieDzejkob Sep 8 '17 at 18:19

# 150. Julia 0.6, 125 bytes, A001993

function A001993(n)
m=zeros(15,15)
for i=1:14
m[i,i+1]=1
end
m[:,1]=[1;2;0;-2;-4;1;3;3;1;-4;-2;0;2;1;-1]
(m^n)[1,1]
end
`

Next sequence

Try it online!

The next one is easy, and all languages are back on the table, so somebody may have to re-work the stack snippet to allow for multiple uses (I don't know enough javascript to tell if that's already there or not).

Implements the matrix product formula given in the OEIS page. It was pretty fun learning a bit of Julia; it's quite similar to Matlab.

• Yay more Python :D :D :D – HyperNeutrino Sep 11 '17 at 15:05
• I've also had a bit of fun learning new languages for this challenge. Except for INTERCAL. – KSmarts Sep 11 '17 at 17:33
• @KSmarts You have been warned. By your own program. – NieDzejkob Sep 11 '17 at 17:39