10
\$\begingroup\$

This is an answer-chaining challenge relating to the OEIS.

Oh, the justification for this is because a company needs one program to print out their OEIS sequences real bad and they have every language.

The answer-chaining format works in the following way:

Someone posts the first answer, from which all further solutions stem. This answer is a program that, given a number N, inputs the Nth number in OEIS sequence of whatever index they choose (we'll call it sequence 1), in whatever language they choose (language 1)

Someone else comes along and chooses their own sequence (that has to be different from the previous, and from all previous sequences). They make a program, in another language (which has to be different from all previous languages), that given a number N in the language 1 outputs the Nth number of sequence 1 and, given a number in language 2 outputs the Nth number of sequence 2.

This process continues ad infinitum.

The nth term of a sequence is the term that comes n times after the first, working from the first item. Here we use 0 and 1-indexing, to be easy on the coders!

No language or sequence reusing.

Input must be an integer or a string representation of an integer and output must be the correct value of the sequence. Error handling (non-int input) is not needed.

You must not post twice in a row.

You must wait an hour or more before posting again.

Whoever is the SECOND-to-last to post after a week of no answers (the person who didn't break the chain) wins, though the contest can continue indefinitely. If you're last and can show that you can add one more language to it, you continue the challenge until the next winner.

You can assume that the input or the output won't be outside the numerical range of your language (for example, assuming that IEEE's limit won't be surpassed by any sequence) but don't be a trickster and abuse this by using a language that only has 1.

Any sequence can be chosen, as long as it hasn't been used before.

The input cannot be out-of-bounds for the sequence you are using.

Two different language versions are different languages (Python 2 and Python 3 are considered different langs of their own). This isn't rigid, but as a rule of thumb, if it's separated from another version of the same language on TIO, it's different.

This isn't banned, but try once not to use the formula the OEIS gives.

If your resulting code is over 65536 characters long, provide a link to access it (e. g. Pastebin).

That's it and that's all. Ready? Set? FUN!

Yes, this IS "One OEIS after another" but put on multiplayer. I thought it'd be cool.

\$\endgroup\$
  • 1
    \$\begingroup\$ I greatly enjoyed One OEIS after another but I'm not very good at polyglots, so I'll probably watch this one from the sidelines. \$\endgroup\$ – Giuseppe Jun 10 at 14:49
  • \$\begingroup\$ Oh boy this sounds familiar :sweating: \$\endgroup\$ – HyperNeutrino Jun 10 at 14:51
  • \$\begingroup\$ Yeah. Thought it'd be cool and I haven't seen it. \$\endgroup\$ – Andrew Jun 10 at 14:52
  • \$\begingroup\$ @HyperNeutrino "ah shoot, here we go again" \$\endgroup\$ – Giuseppe Jun 10 at 14:53
  • 1
    \$\begingroup\$ Some submissions use 0-indexing and others use 1-indexing (see the comments under submission #10). I suggest you allow both. \$\endgroup\$ – Robin Ryder Jun 13 at 16:07

21 Answers 21

2
\$\begingroup\$

15. Commentator, A020739

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC//*/0#
/*	
박망희		   		0#
;*/	
 	

n=>5/2>2?1:40-n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

C#
Brainfuck
Runic Enchantments
Jelly
Gol><>
Javascript (Node.js) (All 1s)
Parenthetic
Whitespace (All 3s)
05AB12 (All 0s)
Unreadable
Grass
Width
AlphaBeta
Aheui (All 2s)

I had a few plans with Commentator, but only one survived contact with all the other languages. One caused errors in the Jelly (iirc) and I wasn't able to resolve it because I don't know why Jelly interpreted the bytes the way it did.

\$\endgroup\$
  • \$\begingroup\$ Remaining languages left (up from before, I found some new ones!): about 6-12. \$\endgroup\$ – Draco18s Jun 26 at 21:22
  • \$\begingroup\$ Could you give me some starting pointers/tips for Runic Enchantments.. I was able to add code for the new language, and the only thing left to fix is Runic Enchantments. If I understand correctly RE is a 2D path-walking language which starts at the top-left and changes directions based on things like /\ and its mana. Could you give a brief explanation of what the execution flow is in this latest nr. 15 answer is for Runic Enchantments? \$\endgroup\$ – Kevin Cruijssen Jun 27 at 14:28
  • 1
    \$\begingroup\$ @KevinCruijssen It doesn't start at the top-left, different from ><> and a lot of other 2D languages. It starts at any (and all) of ><^v. The only time it starts at the top left is if the code contains none of those bytes and is only one line long. So this polyglot has a lot of IPs in Runic, but the only one that does anything (currently) is this one: >2?1:40-n/. The 2? skips the 1: and so the first instructions are push 4, push 0, subtract (4-0 → 4). Then a lot of nothing happens until it gets to /ip@ which results in take input, pow(y,x), print-and-terminate. \$\endgroup\$ – Draco18s Jun 27 at 14:47
  • \$\begingroup\$ And I do mean a lot of IPs. Most end up performing a stack-underflow in some manner and terminating without generating output. \$\endgroup\$ – Draco18s Jun 27 at 14:58
  • \$\begingroup\$ Ah ok, that makes sense, thanks! And I just realized I forgot to build in your latest Commentator as well. Will see if I can fix both to complete my answer. \$\endgroup\$ – Kevin Cruijssen Jun 27 at 14:58
4
\$\begingroup\$

4. Jelly, A000312

n=>40-n//
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
       //ip@
       //
;/**/

C# (Visual C# Interactive Compiler)
brainfuck
Runic Enchantments
Jelly

Explanation:

We only account for the last line, all of the other lines are ignored.

;/**/ Argument: z
;/    Reduce z by ; (concatenation) [1]
      z is an integer, so this just returns z itself.
   */ Reduce z by * (exponentiation) [2]
      Again, this returns z itself.
  *   Exponentiation: return [1] ** [2]
      This resolves to (z ** z).

To make C# ignore the code, we're trying to put it in a comment. However, a line starting with / isn't valid in Jelly, because / needs an operand. The operand we're using here is ;, since that also fits perfectly as a semicolon in C#. In fact, the semicolon and empty multi-line comment together make a link that calculates \$^2z=z^z\$. Note that the function submission in C# is still valid, as there's no general consensus disallowing multiple statements in an anonymous function submission (e.g. imports).

\$\endgroup\$
  • \$\begingroup\$ I'd love am explanation of how the Jelly code does its thing. \$\endgroup\$ – Draco18s Jun 10 at 19:43
  • \$\begingroup\$ @Draco18s Added. \$\endgroup\$ – Erik the Outgolfer Jun 10 at 19:50
  • \$\begingroup\$ Ah, perfect. Explains that. Thanks much. \$\endgroup\$ – Draco18s Jun 10 at 19:53
3
\$\begingroup\$

16. Java 8, A000290

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC//*/0e#'
/*  
박망희             0#
;*/ 
    //\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip@
                          //
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Never thought I'd see the day where I would be able to add a Java answer as 16th answer in a polyglot-chain! :D

1. Try it in C#: \$a(n)=40-n\$
2. Try it in brainfuck: \$a(n)=1+n\text{ mod }2\$
3. Try it in Runic Enchantments: \$a(n)=4^n\$
4. Try it in Jelly: \$a(n)=n^n\$
5. Try it in Gol><>: \$a(n)=-n\$
6. Try it in JavaScript: \$a(n)=1\$
7. Try it in Parenthetic: \$a(n)=1\text{ if }x^n+y^n=z^n\text{ has a nontrivial solution in integers, otherwise }a(n)=0\$
8. Try it in Whitespace: \$a(n)=3\$
9. Try it in 05AB1E: \$a(n)=0\$
10. Try it in Unreadable: \$a(n)=n\$
11. Try it in Grass: \$a(n) = \lfloor n/10^\left(\lfloor log_{10}(n)\rfloor\right)\rfloor\$
12. Try it in Width: \$a(n)=n+1\text{ with }n\geq2\$
13. Try it in AlphaBeta: \$a(n)=1\Vert n\$
14. Try it in Aheui: \$a(n)=2\$
15. Try it in Commentator. \$a(n)=2n+6\$
16. Try it in Java 8: \$a(n)=n^2\$

Explanation:

Let me start by saying that although I've heard from each of these languages before here on CGCC, I'm only skilled with Java, C#, 05AB1E, and Whitespace, and apart from that can read the JavaScript part of the code. The other languages are mostly unfamiliar for me, so I hoped after the changes I had in mind to make the Java interact with C#/JavaScript, most other languages would still work.

The first main thing to tackle was Java's n-> vs C#/JavaScript's n=>. Java support unicode values as part of the code, so using the following:

//\u000A\u002F\u002A
n=>//\u002A\u002Fn->

Will be interpret as this in C#/JavaScript:

//\u000A\u002F\u002A
n=>//\u002A\u002Fn->

But as this in Java:

//
/*
n=>//*/n->

This is because \u000A is a line-break, \u002F is / and \u002A is * in Java.

Then to differentiate the sequence between Java vs C#/JavaScript I added the following:

""+n==""+n?...:n*n

where ... is the existing 5/2>2?1:40-n, and n*n is the Java part of the code for oeis sequence A000290 (squares a.k.a. \$a(n)=n^2\$).

Why does this work? In Java Strings are Objects, where == is used to check if references of objects are pointing to the same place (or to check if primitives are equal), and the actual Object.equals(Object) has to be used to check if the values of these Objects are the same. So ""+n==""+n will be falsey in Java, but truthy in C#/JavaScript.


After that was tackled (by re-using the existing newlines to not break the Whitespace program), some things had to be fixed. Four of the existing programs were failing now: Runic Enchantments, Jelly, Unreadable, and Commentator.

The fix for Unreadable was easy. We added four """" before the first ', so we simply put the ' somewhere earlier (I placed it at the end of the first line), and remove the leading '"""" from the Unreadable part of the code at the bottom.

After that came Jelly, which was giving an IndexError: pop from empty list. I'm not too skilled in Jelly, so I don't exactly know why it gave this error. If I remember correctly the last line will be the main-link of a Jelly program, and because the code in that last line doesn't use any of the other links, everything else should be ignored. But somehow the part ""+n==""+n still gave some issues. I was able to fix this by adding /**/ in front of that line.

As for Runic Enchantments, it didn't output anything anymore. @Draco18s pointed out to me that Runic Enchantments starts at all > simultaneously, but only the >2?1:40-n/ and /ip@ were relevant. This was a huge help to understand the flow of the Runic Enchantments program, and I was able to fix the path by adding a /**/ at >2?1:40-/**/n:n*n, and changing the positions of the //ip@, //, and space on the last line.

All that's left was Commentator. At that point I realized that my previous fixes of adding /**/ weren't such a good idea after all, since it would output a bunch of additional rubbish due to the builtins /* (convert active to unicode character and output) and */ (output active as number).. >.> After a bit of fiddling around and trying some things, the fix turned out to be very easy: I've added an e before the # on the first line. e# is the builtin to negate an active, fixing the issues caused by the code I added (apparently).

\$\endgroup\$
  • 2
    \$\begingroup\$ Wow, good job on that. I didn't anticipate seeing Java get added at this point either. \$\endgroup\$ – Draco18s Jun 27 at 17:42
  • \$\begingroup\$ @Draco18s I'm glad this polyglot challenge didn't start with Python, since then it would have already been impossible to add Java. JavaScript/C# are rather similar as Java in terms of comments and execution, so that helped a lot here. Glad I have it working. Good luck on the next chains. I'm probably not able to make any more chains, but I hope to see it grow at least a few more times. :) \$\endgroup\$ – Kevin Cruijssen Jun 27 at 18:59
  • \$\begingroup\$ The ones I have prepped are ones that either use a character set that non-interferes and ignores characters not in its instruction set, or 2D languages that use different rules. \$\endgroup\$ – Draco18s Jun 27 at 19:29
2
\$\begingroup\$

6. JavaScript (Node.js), A000012

//
n=>5/2>2?1:40-n//
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
               //ip@
               //
;/**/
//I01-* h
//
 ;/**/

C# (A022996): Since 5/2==2 the function returns 40-n (Line 2)

BF (A000034): The added part only pushes the whole tape one cell to the right, others unchanged (Line 2-3)

Runic (A000302): The ? after 2 skips the 1:, and other operations follows from 4 (Line 2)

Jelly (A000312): Unchanged last line

Gol><> (A001489): Unchanged first column

JS(ES6) (A000012): Since 5/2>2 the function returns 1 (Line 2)

Sneaked the ternary 5/2>2?1:40-n into the C# part. In C# since 5/2==2 the function returns 40-n, while in JS 5/2>2 the functions returns 1. The C-style comments made it nearly impossible to add more practical languages (specifically C and Python). More spaces are added on lines 4-5 to ensure that the Runic part works.

\$\endgroup\$
  • 1
    \$\begingroup\$ The C-style comments made it nearly impossible to add more practical languages (specifically C and Python). Such is the way of polyglot challenges. \$\endgroup\$ – Draco18s Jun 11 at 3:31
2
\$\begingroup\$

8. Whitespace, A010701

//   
	
		   		
	
 	

n=>5/2>2?1:40-n//(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
               //ip@
               //
;/**/
//I01-* h
//
 ;/**/

Try it online!

C#
Brainfuck
Runic
Jelly
Gol><>
Javascript
Paranthetic

I have no idea how Whitespace works. I tried super hard to multiply the input with another value, but it kept complaining about infix arithmetic, so as I had input working, output working, and push-value-to-stack working, so I just went with that.

The input value appears to get lost when pushing 3 to the stack, but oh well. Enjoy a sequence of 3s. The program does technically take input it just ends up discarding it.

I also don't know how Paranthetic works, so I can't actually verify that submission as valid, but as far as I can tell the Whitespace code doesn't interfere.

Future answers: be aware that tabs in Runic are a single instruction wide and play havoc with code layout.

\$\endgroup\$
  • \$\begingroup\$ I don't know Whitespace either, but reading from the documentation, it seems input values are actually stored at the heap location pointed to by the top of the stack, not on the stack itself. \$\endgroup\$ – ArBo Jun 11 at 21:49
  • \$\begingroup\$ @ArBo Possible. I just know that if I did "read, print" I would get my input back. But if I did "read, push 10, print, print" I would get 10 and an error. So I went "heck with it" and just did what I knew I could. \$\endgroup\$ – Draco18s Jun 11 at 22:45
  • 1
    \$\begingroup\$ FYI: input in Whitespace is indeed pushed to the heap, which acts as a dictionary/map. So let's say you do: push 10, read STDIN. The stack will be empty, and the heap will contain [{10: input}]. To make a cat program that reads and outputs immediately in Whitespace, you usually want to do something like: Push 0; duplicate 0; read STDIN; retrieve (this will pop the 0 we duplicated, and push the value from heap-address 0 to stack); pop and output to STDOUT. PS: Here a useful online debugger I always use. \$\endgroup\$ – Kevin Cruijssen Jun 27 at 14:19
  • \$\begingroup\$ @KevinCruijssen Useful! \$\endgroup\$ – Draco18s Jun 27 at 14:24
2
\$\begingroup\$

11. Grass, A000030

//0q   
	
		   		
	
 	

n=>5/2>2?1:40-n//(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

Grass ignores all characters except w, v and W; conveniently, these three characters are ignored by several of the previously used languages. Luckily, sequence A000030 (return the initial digit in base 10) was still available, as coding even slightly complicated functions in Grass is beyond my ability.

C#
brainfuck
Runic
Jelly
Gol><>
JavaScript
Parenthetic
Whitespace
05AB1E
Unreadable

The relevant part for Grass is wvWwwWWwwwwwwWwWWWw. Here is my (probably flawed) understanding of how it works: the stack is initialized as OUT::SUCC::w::IN::ε (that w is just the character w). Each instruction adds an element to the stack (they are never popped); the number of ws or Ws indicates how deep to go in the stack; v separates instructions.

wv        # identity
Www       # identity OUT
WWwwwwww  # identity IN (read in 1 character)
Ww        # apply the function identity IN
WWWw      # apply the function identity OUT to the value at the top of the stack

If the input is 1234, at the end, the stack probably looks like this: 1::1::id IN::id OUT::id::OUT::SUCC::w::IN::ε.

It could be made shorter (don't need to define id OUT for example), but I stopped as soon as I found a version which worked.

If someone who knows Grass wants to correct/improve the explanation, please edit my answer!

\$\endgroup\$
  • \$\begingroup\$ This is one of the languages I identified as workable, but wasn't able to understand the documentation and write the code for. +1 \$\endgroup\$ – Draco18s Jun 14 at 13:38
  • 1
    \$\begingroup\$ @Draco18s I've tried to add an explanation of how it works. \$\endgroup\$ – Robin Ryder Jun 14 at 14:06
  • \$\begingroup\$ Certainly helps, but still head-scratching. I've had to rework one of my future answers as you yoinked A000030 (languages that take input as single bytes are a pain; 3 byte program turned into nearly 60 (yes, I really have planned that far ahead)). \$\endgroup\$ – Draco18s Jun 14 at 16:40
2
\$\begingroup\$

17. Pepe, A000578

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC//*/0e#'
/*	
박망희		   		0#
;*/	
 	//\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip@
                          //rEeE rEeeEe reEE
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Online Interpreter

C#
Brainfuck
Runic Enchantments
Jelly
Gol><>
Javascript (Node.js) (All 1s)
Parenthetic
Whitespace (All 3s)
05AB12 (All 0s)
Unreadable
Grass
Width
AlphaBeta
Aheui (All 2s)
Commentator
Java

You'll have to excuse the Pepe link for not containing the full source: The interpreter disregards any code that is not Pepe (lit. any character not in the set RE re) and so its short link doesn't bother encoding it. Ditto input values.

Computes \$a(n) = n^3\$

The AlphaBeta has started throwing errors after writing output, but as a prior answer injected that issue I left it alone. I had planned on fixing it for this answer, but I need to spend some time digging into the jump offsets to resolve the issue. The error with inputs >0 are easy to fix, but giving it 0 will produce the same error and it will take time to relearn the code in order to fix the offset for it. I wish I could use W instead of UUUUUUUUUU, but it plays havoc with the Grass code.

\$\endgroup\$
  • \$\begingroup\$ Another 4-11 languages to go. One of the ones I'd templated out decided to make the Brainfuck throw a hissy fit, so I didn't use that one for this answer (I was going to!). Given how early the BF was done, I'm questioning if it ever worked and I just didn't check the BF. \$\endgroup\$ – Draco18s Jul 5 at 3:20
  • \$\begingroup\$ [Full disclosure regarding accept mark] I forgot that Thursday the 4th was a holiday and didn't have access to my notes in time to post this answer before a week had gone by. I had slowed down my answering rate in an attempt to allow others to find and post answers; I had not intended to outlast the grace period (had I wished to do so, I could have by not posting #15 at all, letting #13 get accepted) as I was interested in seeing how far this would go and I intend to post the other 4 or 5 languages I've solved for before listing the remaining langs I think could still work, if I can't do them. \$\endgroup\$ – Draco18s Jul 5 at 17:46
1
\$\begingroup\$

1. C# (Visual C# Interactive Compiler) A022996

n=>40-n

Also works in C# (.NET Core), C# (Mono C# compiler), C# (Mono C# Shell), and C# (Visual C# Compiler)

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Also works in Javascript. \$\endgroup\$ – someone Jun 12 at 13:45
1
\$\begingroup\$

9. 05AB1E, A000004

//0q   
	
		   		
	
 	

n=>5/2>2?1:40-n//(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
               //ip@
               //
;/**/
//I01-* h
//
 ;/**/

C# (Visual C# Interactive Compiler)
brainfuck
Runic Enchantments
Jelly
Gol><>
JavaScript (Node.js)
Parenthetic
Whitespace
05AB1E

\$\endgroup\$
1
\$\begingroup\$

7. Parenthetic, A019590

//
n=>5/2>2?1:40-n//(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
               //ip@
               //
;/**/
//I01-* h
//
 ;/**/

C# (A022996)

BF (A000034)

Runic (A000302)

Jelly (A000312)

Gol><> (A001489)

JS(ES6) (A000012)

Parenthetic (A019590)

Parenthetic ignores everything but the ( and ) characters. I've had to insert 1s before every closing parenthesis to stop Jelly from freaking out though (EDIT: I left one ) unpreceded by a 1, so apparently not all of them need one, but it's too late to golf it down now). The actual code defines a lambda called ((())), that can be called on a number to yield the result (1-indexed).

\$\endgroup\$
  • \$\begingroup\$ I would like to understand how to pass input to Paranthetic, because I can see that the sequence is not constant, but don't know how to actually get the program to change its output. Nope. Nope. Nope. \$\endgroup\$ – Draco18s Jun 12 at 16:13
  • \$\begingroup\$ @Draco18s It doesn't take input in the sense you're trying to do. The code itself defines a function, called ((())). The footer calls that function, with whatever argument you want. The set of parentheses under the number 2 means 2 in Parenthetic. Changing the final ()() to ()*n will call the function on n. \$\endgroup\$ – ArBo Jun 12 at 18:13
  • 1
    \$\begingroup\$ Ahh...That makes sense now. It was just something I'd been poking at because I had no good way to verify the submission and insuring is validity moving forward (I was in a "it still outputs the same thing, so it must be fine, I guess?" mode). That helped. \$\endgroup\$ – Draco18s Jun 12 at 19:12
1
\$\begingroup\$

10. Unreadable, A001477

//0q   
	
		   		
	
 	

n=>5/2>2?1:40-n//(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

C#
Brainfuck
Runic
Jelly
Gol><>
Javascript
Paranthetic
Whitespace
05AB1E

Unreadable, as its name suggests, is unreadable. In order to program it I had to use a template and then convert from readable text to Unreadable code.

[A=READ()];DO{(A+1)?:BOTH(PRINT(A),[A=READ()])}
[A=READ()]: '""""""'"""'""""""""""
PRINT(A): '"'"""""""'"""
A?: '""'"""
Functioning:
['""""""'"""'""""""""""];'"""""{('""'"""""""'""")?:'""""('"('"""""""'"""),['""""""'"""'""""""""""])}

All it does is read each character in the input and output it. One of the more boring sequences, but good for a language that's difficult to work with. I also toyed with using the sequence A000030 before getting the loop to work.

Working via remote desktop is a pain, you think things work, do all the links, then realize that one of them broke and didn't notice.

\$\endgroup\$
  • \$\begingroup\$ I forgot to remove it, but the ;/**/ in the middle area is not doing anything and could be removed. 99% sure. It was a Jelly chunk, but it got duplicated somewhere along the way and no longer serves a purpose. \$\endgroup\$ – Draco18s Jun 12 at 14:25
  • \$\begingroup\$ @RobinRyder Ditto, also fixed link to Runic (bad copy-paste somewhere along the way). See #3 for an explanation of why it works in Runic. \$\endgroup\$ – Draco18s Jun 13 at 16:34
  • \$\begingroup\$ For reference: I know for a fact that it is possible to add at least 5 more to the chain from here, but probably closer to 15. \$\endgroup\$ – Draco18s Jun 13 at 17:04
1
\$\begingroup\$

14. Aheui, A007395

Slightly changed to make AlphaBeta works.

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC
/*  
박망희*/               



n=>5/2>2?1:40-n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

Aheui dismiss any non-Korean character, so 박망희 excuted, which prints 2 and terminates.

C#
Brainfuck
Runic Enchantments
Jelly
Gol><>
Javascript (Node.js)
Parenthetic
Whitespace
05AB12
Unreadable
Grass
Width
AlphaBeta
Aheui

\$\endgroup\$
  • \$\begingroup\$ So we have all 1, all 2 and all 3 now lol \$\endgroup\$ – Shieru Asakoto Jun 21 at 9:23
  • \$\begingroup\$ @ShieruAsakoto oh, was there all 3? I didn't knew that. \$\endgroup\$ – LegenDUST Jun 21 at 12:09
  • \$\begingroup\$ #8 is the all-3. Mine (#6) is the all-1. \$\endgroup\$ – Shieru Asakoto Jun 21 at 12:26
  • \$\begingroup\$ *Crosses that one off the list.* Knew it would work, but didn't know how to program in it and the documentation wasn't easy to understand at a brief glance. Now to make sure the other answers I've written still have a place to squeeze into. \$\endgroup\$ – Draco18s Jun 21 at 14:02
  • 1
    \$\begingroup\$ @Draco18s moved /* and it works now. And Aheui code is (slightly more) good to see. \$\endgroup\$ – LegenDUST Jun 22 at 4:17
0
\$\begingroup\$

2. brainfuck, A000034

n=>40-n
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.

Try it online!

C#

\$\endgroup\$
0
\$\begingroup\$

3. Runic Enchantments, A000302

n=>40-n//
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
       //ip@
       //

Try it online!

C#

BF

If you need help keeping the Runic functional, there is the Esoteric IDE as well as my own IDE (built in Unity3D) in the master branch of Runic's git repo. Esoteric IDE doesn't handle displaying the IP directionality very well (primarily my own inability to add such to the existing framework).

All the BF creates a bunch of IPs that self terminate due to performing invalid actions (mainly due to stack underflow) while the > in the C# populates the stack with a 4, bounces of the comment makers (mirrors in Runic), reaching ip@ to execute x^4 on an input x and print the result.

\$\endgroup\$
0
\$\begingroup\$

5. Gol><>, A001489

//
n=>40-n//
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.
       //ip@
       //
;/**/
//I01-* h
//
 ;/**/

Try it online!

C#
Brainfuck
Runic
Jelly

Use single-line comment markers in C# to redirect the Fish IP to the operative code, I01-*h, reading input, multiplying by -1, and outputting the result. Gol><> made reading input and dumping the stack as a number easy compared to raw ><>.

Spaces inserted to insure the proper flow of the Fish and Runic IPs, where both C# and Jelly ignore the leading whitespace on the last line (and is a NOP cell in both fungoids).

\$\endgroup\$
0
\$\begingroup\$

12. Width, A020725

//0q   
	
		   		
	
 	

n=>5/2>2?1:40-n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

1-indexed. Outputs by exit code.

Try it online!

The only relevant characters to Width are a-zA-Z. The code Width runs is the following:

qnnAcaAcAAI

The first three characters, qnn, are no-ops. Ac reads an integer from input, a is a no-op, and then AcAA increments the integer by one. I ends the program, and the top of the stack is becomes the exit code. All other letters in the program are ignored since the program terminated.

C#
brainfuck
Runic Enchantments
Jelly
Gol><>
JavaScript
Parenthetic
Whitespace
05AB1E
Unreadable
Grass

\$\endgroup\$
  • \$\begingroup\$ I vaguely maybe remember running across this one in my search of eslolangs to consider for this challenge. I think I dropped it due to a conflict with another language I was considering, but I think I'm still good. Cursory check suggests I can make the two play nice. \$\endgroup\$ – Draco18s Jun 15 at 16:27
0
\$\begingroup\$

13. AlphaBeta, A162672

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC
	
		   		
	
 	

n=>5/2>2?1:40-n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
               //ip@
               //
;/**/
//I01-* h
//
 ;/*'""""""'""" '""""""""""'"""""'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

I had originally planned to use sequence A000030 and the code JCL, but that got yoinked (I don't blame them, its a good sequence for languages that take input as single bytes). The original code for this entry after having to pick a new sequence was:

JiiiiihhZUUUUUNYAxcccccbCLDLxyzUUUUTTxxyzJCLOzWRxyxyzcccccbbCL
^                                                                 Read input (single byte)
                 ^          ^^^      ^^^^    ^  ^^^^^             Clear regisers
        ^                                            ^^^^^^^^^    Input = 0: print 0
 ^^^^^^^ ^^^^^                 ^^^^^^         ^                   Set jump locations
                  ^^^^^^^^                                        Print `1`
                          ^^                                      Print initial byte
                                         ^^^                      Read and print input
                                            ^                     (and loop)

Sequences of xxx or xyzxyz are useful spacers to make the jump-to targets easy values (46 is easier as "5*10-4"--9 instructions--than "4*10+6--ten instructions--but 50 is even simpler: only five). You'll see a fair few of those.

But as there are other bytes on the first line, the jump-to codels needed some new values and that turned into:

//0q   xxxJiiiiihhZUUUUUUNYAxcccccbCLDLxyzUUUUUTxxyzJCLOzWRxyxyzcccccbbCL

Avoiding executing this code as Width code just involved wrapping it in G to make it a string literal (which does nothing important in AlphaBeta), a command to pop the top of the stack, and then some extra W to make alpha beta not crash when exiting:

//0q   GxxJiiiiihhZUUUUUUNYAxcccccbCLDLxyzUUUUUTxxyzJCLOzWWWWWWRxyxyzcccccbbCLGw

To avoid conflicts with Grass, though, instead of popping the command with w C is used instead. Then the "exit program" jump is replaced with UUUUUU instead of WWWWWW This does leave the IP somewhere in the middle of the rest of the junk code, but far enough out that it doesn't print any errors. Any number of additional Us can be added in pairs if this becomes a problem.

//0q   GxxJiiiiihhZUUUUUUNYAxcccccbCLDLxyzUUUUUTxxyzJCLOzUUUUUURxyxyzcccccbbCLGC

The additional i that Runic ends up executing is a NOP on valid inputs as no-input-left-to-read pushes nothing to the stack ("reading all input" is a pain in Runic).

C#
brainfuck
Runic Enchantments
Jelly
Gol><>
JavaScript
Parenthetic
Whitespace
05AB1E
Unreadable
Grass
Width

\$\endgroup\$
  • \$\begingroup\$ Anywhere between 4 and 11 more languages to go. But here's some languages that could use some investigation: Ook!, Jolf, Blank, and Brackets. I don't know if they can be used or not, and my intuition says probably not, but haven't given them a bash (mainly because they're not on TIO). \$\endgroup\$ – Draco18s Jun 17 at 14:46
0
\$\begingroup\$

18. ]=[, A010716, the all 5's sequence

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC//*/0e#'[=====[===]]=[[==========]]=[
/*] 
박망희             0#
;*/ 
    //\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip@
                          //rEeE rEeeEe reEE
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

This language isn't on TIO and its only interpreter is written itself in another interpreted language, which is also not on TIO. And the one that didn't play nice with Brainfuck last week at the last minute, but I figured out what was wrong a few hours after posting the Pepe answer, so I saved it for this week. Being a language not on TIO I was considering this one an ace-in-the-hole that could easily be tacked onto just about ANY entry and continue the chain.

Put the interpretter code into the "code" box at the top, code from the answer in the input, and click run and get an output (plus some extra junk that is always printed).

The operational portion of the ]=[ is this at the end of the first line:

[=====[===]]=[[==========]]=[

Its that trailing [ that played havoc with the Brainfuck (the rest being ignored, due to how [ and ] are handled by Brainfuck) and once I looked at the Brainfuck spec again I realized the problem and that all I had to do was insert a ] somewhere after the first line (as the ]=[ interpreter does not read newlines) and before the Brainfuck. I chose the 2nd line.

C#
Brainfuck
Runic
Jelly
Gol><>
JavaScript (Node.js)
Paranthetic
Whitespace
05AB1E
Unreadable
Grass
Width
AlphaBeta
Aheui (esotope)
Commentator
Java (OpenJDK 8)
Pepe

\$\endgroup\$
  • \$\begingroup\$ I still have 3 more languages worked out in detail and another 10 that should work, but which I haven't attempted. \$\endgroup\$ – Draco18s Jul 11 at 22:08
0
\$\begingroup\$

19. Actually, A005843 (2*n)

//0q   GxxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLGC//*/0e#,2*1z⌂'[=====[===]]=[[==========]]=[
/*]	
박망희		   		0#
;*/	
 	//\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip@
                          //rEeE rEeeEe reEE
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

Operational part: ,2*1z⌂ (first line)

As terminates the program, none of the code after it has any effect, and none of the symbols before it result in any output or pollute operational memory adversely. Section exists within a comment (C#, JS, Java), only contains ignored characters (Commentator, ]=[, Pepe, Aheui...), is not on the last line (Jelly), or otherwise in un-executed parts of the code (Gol><>, Runic, AlphaBeta).

C#
Brainfuck
Runic
Jelly
Gol><>
JavaScript (Node.js)
Paranthetic
Whitespace
05AB1E
Unreadable
Grass
Width
AlphaBeta
Aheui (esotope)
Commentator
Java (OpenJDK 8)
Pepe
]=[ (link not possible, see #18 for instructions)

\$\endgroup\$
  • \$\begingroup\$ Still have 2 already worked out and a third that will be easy. Also, the sequence ]=[ can't be turned into a url. \$\endgroup\$ – Draco18s Jul 18 at 17:40
0
\$\begingroup\$

20. Neim, A008592 (10*n)

//0q   ÷GxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLxGC//*/0e#§≈2*1z⌂'>[=====[===]]=[[==========]]=[
/*]	
박망희		   		0#
;*/	
 	//\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip@
                          //rEeE rEeeEe reEE
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

I have no idea how the heck Neim works. I know what the code here ends up doing, but I have no idea how the language itself works.

Also turns out I messed up the Brainfuck with #19. Due to command conflicts between multiple languages, changing Actually's input to § and then coercing it to an int with was the optimal solution.

C#
Brainfuck
Runic
Jelly
Gol><>
JavaScript (Node.js)
Paranthetic
Whitespace
05AB1E
Unreadable
Grass
Width
AlphaBeta
Aheui (esotope)
Commentator
Java (OpenJDK 8)
Pepe
]=[ (link not possible, see #18)
Actually

\$\endgroup\$
  • \$\begingroup\$ Can you believe I've still got 2 more I can do? \$\endgroup\$ – Draco18s Jul 26 at 2:36
  • \$\begingroup\$ let's see how long it takes until wipeout \$\endgroup\$ – Andrew Aug 2 at 14:39
  • \$\begingroup\$ Oh, I forgot to post another yesterday. Life's been real busy, trying to figure out who it is that keeps waking me up at 6:30 and/or 7:30 with a loud engine so I can report them to housing management and/or the city for noise disturbance. Also the new gold battle KOTH. Just creating the 20+ links for all the languages takes up about an hour now (even if there's no issues). \$\endgroup\$ – Draco18s Aug 2 at 16:49
0
\$\begingroup\$

21. Flobnar, A010709 (All 4s)

//0q   ÷GxJiiiiihhZUUUUUUUNYAxcccccbCLDLxyzUUUUUTxyzJCLOzUUUUUURzyzxyzxyzcccccbbCLxGC//*/0e#§≈2*1z⌂'>[=====[===]]=[[==========]]=[
/*]	
박망희		   		0#
;*/	
 	//\u000A\u002F\u002A
n=>//\u002A\u002Fn->
/**/""+n==""+n?5/2>2?1:40-/**/n:n*n//AcaAcAAI(((1)(1)(1)1)((1)(((1)1)1)1)(((1)(1)1)(((1)((1)1)(1)1)1)(((1)(1)(1)(1)1)(((1)(1)((1))(1)1)((1)((1)1)(1)1)(((1)1)(1)(1)1)1)(((1)1)(1)1)(((1)1)1)1)1)1)
//[>[-]<[>+<-],]>>+<[->[>>+<<-]>[<+>-]>[<+>-]<<<]>>>>++++++[<++++++++>-]<<[>+<-]>+.wvWwwWWwwwwwwWwWWWw
                          //ip!4@
                          //rEeE rEeeEe reEE
;/**/
//I01-* h
//
 ;/*""'"""'""""""""""'"""" "'""'"""""""'"""'""""'"'"""""""'"""'""""""'"""'""""""""""*/

Try it online!

Flobnar starts at @ and expands outwards evaluating items as the rules dictate (@ evaluates to whatever's on its left, 4 evaluates to 4, + evaluates to whatever's on the left summed with whatever's on the right, etc). As the placement of the @ only comes into contact with Runic, a simple ! prevents alteration of Runic's stack.

Given that Flobnar's input metric is "one byte" and goes into an infinite loop if there are no bytes to read, I decided not to bother with anything more complex.

Previous languages

C#
Brainfuck
Runic
Jelly
Gol><>
JavaScript (Node.js)
Paranthetic
Whitespace
05AB1E
Unreadable
Grass
Width
AlphaBeta
Aheui (esotope)
Commentator
Java (OpenJDK 8)
Pepe ]=[ (link not possible, see #18)
Actually
Neim

\$\endgroup\$
  • \$\begingroup\$ Input evaluates the term to the south on EOF, it doesn't go into an infinite loop \$\endgroup\$ – Jo King Aug 28 at 22:50
  • \$\begingroup\$ Ah, thanks. Even so, at one-byte-per-evaluation, it's a difficult thing to actually utilize. 4@ worked easily enough that I just went with that. \$\endgroup\$ – Draco18s Aug 29 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.