Code-generator with unique characters

35

5

Challenge

Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1. The chain ends the first time 1 is outputted.

None of your programs may share any characters (there's one exception in the Rules-section).

The winning submission will be the submission with the longest chain. The tie-breaker will be shortest total code-length.


Rules:

  • You may use both functions, programs and snippets. You may assume a REPL environment.
  • All functions must be written in the same language
  • Symbol independent languages are disallowed. This includes partially symbol independent languages such as Headsecks.
  • Default output formatting may optionally be disregarded in a function's output. This includes trailing newlines, ans = etc.
  • You may reuse the space character (ASCII code point 32), but note the following:
    • You may use as many space characters as you like in one of the functions, but restrict it to maximum 5 in all other functions
    • You may not reuse any characters if code point 32 is not space in your language.
  • None of the programs may take input

  • The chain must be at least two programs long.


Example:

Your initial code is abc+cab+bac. This outputs: foofoo*123, which in turn outputs disp(~0), which outputs 1. This is a chain of 3 programs, with a combined length of 29 (tie breaker).

Stewie Griffin

Posted 2018-05-28T10:52:26.440

Reputation: 43 471

Related – Jo King – 2018-05-28T12:05:26.743

1Somewhat related – Kevin Cruijssen – 2018-05-28T12:07:54.693

To make sure I understood: the programs may use comments, right? I mean, parts of code that are "useless" – Luis Mendo – 2018-05-28T13:00:10.837

@LuisMendo Yes... I'm curious to see how that will help you though :) – Stewie Griffin – 2018-05-28T13:18:48.193

@StewieGriffin Not much really :-) It only makes code length arbitrarily large, but it doesn't seem to help in extending the number of chain links – Luis Mendo – 2018-05-28T13:27:22.130

If the language prints strings with quotation marks, can the next program just contain the string without the quotes, or does the next program always have to be literally the entire output of the previous one? – ngm – 2018-05-28T14:18:21.067

Is it ok if we cannot prove or disprove the chain will eventually output a 1? – R zu – 2018-05-28T17:21:10.497

@Rzu You must prove that it will output 1 in the end. – Stewie Griffin – 2018-05-28T18:10:09.917

@ngm quotes must be included. – Stewie Griffin – 2018-05-28T18:31:03.773

The output of each program should be a string (or equivilant), yes? For example, lambda:lambda:1 isn't valid since it returns an function? – Jo King – 2018-05-28T23:42:45.547

2Are simple expressions allowed? For example, could the final link of a Python program be 2^3, which would just evaluate to 1, or does it have to be e.g. lambda:2^3, print(2^3), etc.? – nneonneo – 2018-05-29T01:22:35.253

If a function/snippet returns a string, are the string contents considered to be the code? The current top Java 8 answer uses this fact. – nneonneo – 2018-05-29T01:29:34.950

May the programs share boilerplate, such as int main() and the like? – ollien – 2018-05-29T01:40:28.413

3In languages where literals can be programs (such as in a lot of the golfing langs), can 1 be both a program and the output of that program or does the chain end when 1 is the output? – Emigna – 2018-05-29T07:26:06.153

@nneonneo simple expressions are allowed. That's what is meant by allowing "snippets". Have a look at this answer to another challenge. Such answers are allowed.

– Stewie Griffin – 2018-05-29T10:39:12.217

@Emigna the chain ends when 1 is the output. – Stewie Griffin – 2018-05-29T10:42:10.523

@ollien stuff like this and this is valid. Does that answer the question?

– Stewie Griffin – 2018-05-29T10:45:13.577

Exactly what output types are allowed for a language that has strings? Just strings, or would an array of bytes/chars/code points be allowed? – Jakob – 2018-05-30T18:28:31.217

@Jakob everything that can be copied and use as code directly. – Stewie Griffin – 2018-05-30T19:34:26.633

Probably because it's very very hard. Until someone comes along and posts one with 12 programs. :-) – Stewie Griffin – 2018-06-02T07:13:35.230

Are we allowed to count the output 1.0 as part of the chain, since you state "Default output formatting may optionally be disregarded in a function's output."? So ABC -> 1.0 -> 1 (chain of 2)? (What if I don't want to disregard it to improve the amount of chains.) – Kevin Cruijssen – 2018-06-04T15:01:42.697

That's what optionally means :-) X -> 1.0 -> 1 may count as 2. X -> 1-> 1 counts as 1. Note that the final output should be 1, not 1.0. – Stewie Griffin – 2018-06-04T15:48:26.503

Answers

18

05AB1E, 5-chain: 236 + 29 + 13 + 3 + 1 = 282 bytes

10101100011010001101100010110110001111000111001110101001000000000010111100100110011011010110011000100110101001001101100001110001111010100100000100010010001010011101011001110001000001011010101111001110011110001010111100001110110C₁<Au¦н.V

Try it online!

which prints the program

633693S<J6bαð3<žQTÌ>è9663тαhJ

Try it online!

which prints the program

522472 2-255B

Try it online!

which prints the program

88ç

Try it online!

which prints the program

X

Try it online!

which prints 1

Emigna

Posted 2018-05-28T10:52:26.440

Reputation: 50 798

8784>žxB and I'm probably KO'd. The lack of numbers for base conversion is a total crapshoot unless you calc it. The goal, if you want to beat emigna, is use the least amount of unique numbers per iteration. His answer reigns supreme because of the 88 in the second to last iteration. Truly a great answer. – Magic Octopus Urn – 2018-06-01T00:43:48.080

@MagicOctopusUrn: We could easily free up 10 and make something in binary. But I don't know if we can generate the first program from binary without B. – Emigna – 2018-06-01T07:26:01.050

I'll try again tonight to beat you, but if I don't I'm giving you the bounty. Doesn't seem like many are interested (or able (including me)). – Magic Octopus Urn – 2018-06-05T15:55:00.393

2@MagicOctopusUrn: Your task may be a bit harder as I believe I have a 5-chain ;) – Emigna – 2018-06-05T16:21:27.727

Oh you... beautiful human being. Guess I'll still take a whack at it. I can at least post a 4 chain if it isn't close. – Magic Octopus Urn – 2018-06-05T19:55:40.687

I'm just going to assume this KO'd me, I only have 2 hours tonight. If I find a 6 chain you owe me a bounty ;P – Magic Octopus Urn – 2018-06-05T20:11:43.447

2@MagicOctopusUrn: I'll be happy to :) This was a very fun challenge! – Emigna – 2018-06-05T20:28:32.313

1Congrats for getting the 5th chain! – Chromium – 2018-06-19T06:06:54.997

12

Java 8, chain of 2 functions, 90+10 37+4 28+4 = 32 bytes

o\u002D\u003E"\44\55\76"+2/2

Which is equivalent to:

o->"$->"+2/2

-57 bytes thanks to @OlivierGrégoire.

Try it online.

Which returns the String:

$->1

Try it online.

Which returns the integer:

1

Kevin Cruijssen

Posted 2018-05-28T10:52:26.440

Reputation: 67 575

\u0076\u002D\u003E\u0022\u0076\u002D\u003E\u0022+(3\u002D2) (59 bytes+4 bytes). The rules says "None of your programs may share any characters", so v->1 is valid because the final 1 isn't a program. – Olivier Grégoire – 2018-05-30T12:04:34.353

139 bytes + 4 bytes – Olivier Grégoire – 2018-05-30T12:14:05.980

@OlivierGrégoire I knew v->1 returning 1 is valid, but in my original answer \u0031 would contain a 1, and v->1 would then contain a 1 as well. Nice combination of both unicode Java and regular Java, though. And I golfed 2 more by changing (2/2) to 2/2. (PS: There is also already a chain-3 Java answer by Jakob.) – Kevin Cruijssen – 2018-05-30T12:30:07.707

@OlivierGrégoire Correction, I've been able to golf it to 28+4 by using "\44\55\76" instead of "\u0076\u002D\u003E" – Kevin Cruijssen – 2018-05-30T12:33:57.707

Nice golfing on top of mine ;) I haven't checked the 3-chain answer yet. I'll do it right now. – Olivier Grégoire – 2018-05-30T12:35:17.340

I think that the 3-chain answer is invalid, unfortunately. Can you double-check my reasoning please? – Olivier Grégoire – 2018-05-30T15:20:23.857

What a beauty – Yassin Hajaj – 2018-06-05T03:33:13.917

I want to give this more than +1, but I already bountied another D: – Magic Octopus Urn – 2018-06-05T15:55:33.190

10

R, 3-chain 198 + 44 + 3 bytes

`+`=`\143\141\164`;+"\143\141\164\050\151\156\164\124\157\125\164\146\070\050\143\050\070\070\055\071\055\071\054\071\071\071\055\070\070\071\055\070\055\070\054\070\070\055\071\055\071\051\051\051"

Try it online!

Returns :

cat(intToUtf8(c(88-9-9,999-889-8-8,88-9-9)))

Try it online!

Returns :

F^F

Try it online!

Returns 1

Explanation :

The first program is almost totally written in octal representation, where each character is written as \xxx where xxx is the ASCII code in octal mode. In human readable form would be :

`+`=`cat`;+"cat(intToUtf8(c(88-9-9,999-889-8-8,88-9-9)))"

Here, to avoid the use of round brackets we redefine the prefix operator + equal to cat function, then we use that to print the next string. Even after assigning cat to +, the latter still keeps its prefix operator "status" and will just take whatever follows it as its first parameter.

The second program, simply prints the characters F^F obtaining them from decimal ASCII : 70,94,70

Since in the first program we used the octal representation, only numbers 8 and 9 are free to be used; hence, we obtain 70 and 94 with some differences between numbers with only 8's and 9's.

Finally, the last program, F^F, exploits the ^ function (power of) which coerces FALSE to 0 and computes 0^0 returning 1

Credits to :

  • @ngm for the first 2-chain idea
  • @Giuseppe for the hint to use octals in functions
  • @BLT and @JayCe for the idea to override + in order to avoid brackets

Previous version :

R, 2-chain 27+3 24 + 2 bytes

cat(intToUtf8(c(49,76)))

Try it online!

Returns:

1L

Try it online!

Returns 1.

ngm

Posted 2018-05-28T10:52:26.440

Reputation: 3 974

Nice one! Is cat mandatory? – JayCe – 2018-05-29T13:29:56.867

cat is the shortest way to get rid of quotes. write("1+F","") and substitute(1+F) will also print without quotes, but they all have the letter t in them so I can't think of a way to get a chain of 3. I'm just happy for any R answer in a code-generation challenge! – ngm – 2018-05-29T13:35:52.293

I just saw that you asked in the comments whether quotes have to be removed. and the answer is yes :(. Maybe @Giuseppe will be able to come up with a magic solution? I am stuck too. – JayCe – 2018-05-29T13:39:50.037

cat(intToUtf8(c(48,94,48))) uses only 3 different digits and returns 0^0 – JayCe – 2018-05-29T13:45:00.867

And eval(parse(t="foobar")) also as a t... agree with you, it's great to see an R answer I just wish there was a way to expand it :) – JayCe – 2018-05-29T14:05:35.440

eval(parse(,,"foobar")) does the same without a t. But now there's the a. There's also bquote which still doesn't help. – ngm – 2018-05-29T16:54:44.497

2Well potentially you could have an output as a string with "wri\164e"(function args) to avoid a t or other similar encodings – Giuseppe – 2018-05-30T15:50:32.283

I can't think how is possible to do better than 2-chain in R because of the necessity of round brackets... I mean, the default print method returns values with quotes, so you need at least cat/message at the first step, and then in the next ones you won't be able to use brakets anymore and therefore no functions as well... – digEmAll – 2018-06-03T13:02:04.137

1

@Giuseppe @digEmAll According to the latest comments to the question cat(intToUtf8(c(49,76))) would work and is a bit shorter. Doesn't expand the chain though.

– JayCe – 2018-06-04T20:14:53.407

2

@digEmAll See BLT's comment to my answer to another challenge... I think there might be something here.

– JayCe – 2018-08-06T13:25:01.780

@JayCe: Maybe this ?

– digEmAll – 2018-08-06T20:07:18.077

@digEmAll wow. We have a length 3 chain. – JayCe – 2018-08-06T23:43:32.283

A little shorter 198+44+3 – digEmAll – 2018-08-07T06:49:59.210

2I've made this answer a Community Wiki. Please feel free to add this with a little explanation. – ngm – 2018-08-07T13:37:30.747

8

Python 2, 2-Chain, 7+44 = 51 bytes

lambda:("7072696e74203"+`3-2`).decode("hex")

and

print 1

Try it online!

The base 16 code translates to print 1, which is returned by the anonymous function.

Jo King

Posted 2018-05-28T10:52:26.440

Reputation: 38 234

7

Octave, 3 programs, Length 42 bytes

char("``;8%79b/7%,,b"-5)

Outputs: [[63 24]*2 '']. Try it online!

[[63 24]*2 '']

Outputs: ~0. Try it online!

~0

Outputs: 1. Try it online!

Stewie Griffin

Posted 2018-05-28T10:52:26.440

Reputation: 43 471

7

Perl 5, 3-chain, 151 139 chars (114 + 20 + 5)

&{"CORE::SYSWRITe"|"CORE::39372!4"}(STDOUT,"\x70\x72\x69\x6E\x74\47\x50\x42\x5A\3\22\47\x5E\47\43\43\43\43\43\47")

The ugliness inside the &{ } evaluates to CORE::syswrite, and so the hex-escaped string is printed to standard output as:

print'PBZ^C^R'^'#####'

Please note that the ^C and ^R in the above represent literal control characters. (And not to be confused with the literal ^ caret that occurs between the two strings.)

This program in turn outputs:

say 1

breadbox

Posted 2018-05-28T10:52:26.440

Reputation: 6 893

6

Cjam, 4-chain, 28+20+3+1=52 bytes

Snippet 1:

"tugshrm\x18$\x18vj\x1b\x07um~l$\x1b"{71^}%

Snippet 2:

32 4/5*_c_1-\@2*9+c\

Snippet 3:

'Y(

Snippet 4:

X

Which then prints 1.

Try it online!

Note:

  1. Since Cjam does not have interpretation for escape characters, the ones in snippet 1 are only there for better web view. You need to use the corresponding actual characters to run the snippet.

  2. If I cannot shave off more characters, then good job to @Emigna for the 05AB1E answer!

Chromium

Posted 2018-05-28T10:52:26.440

Reputation: 201

In snippet 2 you've reused the character 1 used in snippet 1 – digEmAll – 2018-06-03T10:47:54.383

See my note please. The escape characters are for the reader's convenience, in Cjam there are no escape characters, or they would not translate into the characters you think would in languages like C or python. When testing, you literally have to enter the characters manually instead of using the escape characters. – Chromium – 2018-06-04T02:28:30.880

ah I see, thanks – digEmAll – 2018-06-04T05:45:02.483

5

Excel, Chain 2, 27+3 bytes

=CHAR(45)&CHAR(45)&CHAR(49)

Not sure if this is OK...

tsh

Posted 2018-05-28T10:52:26.440

Reputation: 13 072

2Shouldn't there be a CHAR(61)& in the beginning as well for there to be a chain of 2? – Emigna – 2018-05-28T12:05:20.787

5You should use french instead of english (CHAR become CAR, 3 bytes saved), not sure if another language reduce it more – Sefa – 2018-05-28T13:11:48.567

1@Emigna But it seems typing --1 in a cell and hit enter, it would just show 1 on the screen... – tsh – 2018-05-29T02:39:58.997

@tsh: Hmm, yeah it seems like Excel adds the = implicitly if you type --1. – Emigna – 2018-05-29T06:37:23.330

Can you use +1 instead of --1? – Neil – 2018-05-29T08:08:40.937

1@Neil Excel does not insert a = mark for +1 (but it does for --1), so I won't consider it as an expression. And I'm not sure if simply writing an 1 in the cell and call it "output 1" is valid. That's why --1 is used. – tsh – 2018-05-29T08:24:40.747

5

x86 bytecode, Chain 2, 10+4 bytes

(Assembled with FASM, format PE)

ÇA.Ï?¿<÷Y. produces 1À@Ã in the address next to it and executes it, which returns 1 in eax (as per fastcall). In both cases the . actually represents A or LF.

In hex: C7 41 0A CF 3F BF 3C F7 59 0A and 31 C0 40 C3.

Disassembled:

mov dword ptr ds:[ecx+A],3CBF3FCF
neg dword ptr ds:[ecx+A]         

produces

xor eax,eax                      
inc eax                          
ret                              

This (ab?)uses the fact that the entrypoint of the program is stored in ecx, and then writes the inverse of the to be executed code to the address 10 bytes over and negates it.

May or may not break if assembled with anything but fasm, to anything but a PE or with a different entrypoint.

S.Klumpers

Posted 2018-05-28T10:52:26.440

Reputation: 171

5

JavaScript REPL, lots of bytes, 4 iterate

(+!![]+[!![]+!![]+!![]+!![]]+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(!![]+!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(!![]+!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(+[])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(+[])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+(+!![])+(!![]+!![]+!![]+!![]))[(![]+[])[!![]+!![]+!![]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()([][[]]))[+!![]+[+[]]]+(![]+[])[!![]+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[+[]]](![])[(+(!![]+!![]+[+[]]+(+!![])+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([]+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]][([][[]]+[])[+!![]]+(![]+[])[+!![]]+([]+(+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+(!![]+[])[!![]+!![]+!![]]]](!![]+!![]+!![]+[+[]])](([]+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()(+[]+[![]])[!![]+!![]+!![]]+(![]+[])[+!![]]+(!![]+[])[+!![]]+(+[![]]+[][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]())[+!![]+[+!![]]]+(!![]+[])[+[]]][([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+([![]]+[][[]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+([][[]]+[])[!![]+!![]]]([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]+[+[]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]])()(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[+!![]]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()(![]+[![]])[+!![]+[+[]]]+(!![]+!![]+!![]+!![]+!![]+!![]+!![])+(!![]+!![]+!![]+!![])+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+!![]+!![])+(!![]+!![])+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(![]+[])[+[]]+(!![]+!![]+!![]+!![]+!![]+!![])+(+[])+(!![]+!![]+!![]+!![]+!![])+([][[]]+[])[!![]+!![]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]()[+!![]+[!![]+!![]]]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])))[([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([![]]+[][[]])[+!![]+[+[]]]+([][[]]+[])[+!![]]]([])
"\x60\44\x7b\55\x7e\x7b\x7d\x7d\44\x7b\55\x7e\x7b\x7d\x7d\x60\56\x73\x70\x6c\x69\x74\x60\x60\56\x74\x6f\x53\x74\x72\x69\x6e\x67\x60\x60"
`${-~{}}${-~{}}`.split``.toString``
1,1
1

Too lazy to optimize the JSFUCK code

JavaScript REPL, 164 bytes, 3 iterate

may be able to expand

[g=222222222222222222,e=2e40,f=2e23,f,2e40,n=2222e49,r=2e24,2e30,e,n,r,8e28,2e40,n,r,9e29,g].map(S=>String.fromCharCode(Math.log(S))).join([])
'\55\x7E\x7B\x7D'
-~{}
1

Try it online!

l4m2

Posted 2018-05-28T10:52:26.440

Reputation: 5 985

@JoKing I didn't use 1 in other pros, so the first 1 is program and the 2nd one is result – l4m2 – 2018-05-29T03:22:47.900

Aren't you reusing the {}s? – Neil – 2018-05-30T09:58:47.153

@Neil Fixed and optimized – l4m2 – 2018-05-30T10:38:41.877

"The chain ends the first time 1 is outputted." – 12Me21 – 2018-05-31T00:29:31.577

5

MATL, 5 programs, 404+159+35+4+1 = 603 bytes

Getting to 4 programs was hard. 5 programs was very hard!

'/'37 13+3+3+'3`/'37 13+3+3+77 13+37 13+3+3+'3`/'37 13+3+3+'3tttttttt`/'37 13+3+3+'3#'37 13+3+3+'3ttttt`'37 13+3+3+'3ttttt'37 13+3+3+77 13+'/'37 13+3+3+'3`<<tttttttttt'37 13+3+3+'3#'37 13+3+3+77 13+37 13+3+3+'3///<3////t````ttttt```<</////t`````t<3tttttttttt<3tt/'37 13+3+3+'3ttttttttt'37 13+3+3+'3`{'37 13+3+3+77 13+'y$'37 13+3+3+'3/////t`````ttI#I'77 13+3+'dk'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh3_+''h

Try it online!

,50],5W50],50qqqqqqqq],50 50qqqqq]50qqqqq5W,50]99qqqqqqqqqq50 5W50,,,90,,,,q]]]]qqqqq]]]99,,,,,q]]]]]q90qqqqqqqqqq90qq,50qqqqqqqqq50]x5Wv!50,,,,,q]]]]]qqF FZah

Try it online!

This might be my favorite program I've written on PPCG:

22 2 2**2-2-- 22Y2 2EEEEEEEEBPX)2) 

Try it online!

84
c

Try it online!

T

Try it online!

Explanation:

Having used hours on this program, I won't write the entire explanation now! I'll write it later!

Short summary:

T            -> Literal true = 1

84c          -> Convert 84 to its ASCII-character T

22 2 2**...  -> Calculate 84 using only 2, * and -
 22Y2        -> 22Y2 is a cell array with the name of all the months
 2EE..B      -> Is 512 in binary [1 0 0 ...]
 P           -> Flips is, [0 0 ... 1]
 X)          -> Uses the binary vector as index and gets the 10th element
             -> 'October'
2)           -> The second character, 'c'
             -> Resulting in the stack: 84, 'c' that's implicitly printed

,50]...      -> A string with ASCII character codes of '22 2...
             -> There's a lot of ,xyz], which means "do twice" and q which is decrement

In order to convert this to a string instead of character codes, we need to concatenate it with a string using h. To get a string, without using quotes, or the XY modifiers, we do base conversion and convert an integer to whitespace.


'/'37 13 ...  -> Concatenation of strings and character codes using only available numbers
3_+           -> Subtract 3 from all character codes to get the correct ones
''h           -> And concatenate with the empty string.

Stewie Griffin

Posted 2018-05-28T10:52:26.440

Reputation: 43 471

5

CJam, 7-chain, 92365+1819+79+14+9+3+1 bytes

This 92365-byte program prints

YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mR1+11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+11+11+11+11+11+1+1+1+1+YaY+`$1<mR11+11+11+11+11+11+11+1+1+1+1+1+1+1+1+1+1+1+1+1+1+YaY+`$1<mR1+1+11+11+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+11+11+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+11+YaY+`$1<mR1+11+YaY+`$1<mR1+1+1+1+1+11+11+1+1+YaY+`$1<mR11+11+11+11+11+11+11+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+YaY+`$1<mR1+1+1+1+1+

which prints

34 4673 4656 4673 4656 5464 4656 4673 4673 4740 34 50 34707 5477]{N7=64777-,=}%

which prints

";*;*Q*;;~"2f^

which prints

9(9(S(99|

which prints

88c

which prints

X

which prints 1.

Lynn

Posted 2018-05-28T10:52:26.440

Reputation: 55 648

4

CJam, 10 programs, 5,751,122,990 bytes

I was too lazy to golf it... But apparently I don't need to golf it to be competitive. But without golfing it is a bit difficult to post the solution in an answer.

It should work in the JavaScript interpreter in theory, but the program is too long to be tested in a browser. It should output the same in the Java interpreter except for the last program. But it may also run out of memory in the Java interpreter for the first few programs.

Statistics

5683631402 bytes, used )\_l
  65027874 bytes, used %&<>WXehrstu{|} and newline
   2247044 bytes, used +DEFHIS~
    199997 bytes, used ,38=[]`
     15352 bytes, used -25:N and space
      1181 bytes, used 67c
        84 bytes, used #'(@CKMTgkp
        21 bytes, used !"$?BJLQR^fijo
        16 bytes, used */4AGYZabdy
        19 bytes, used .09
         1 byte,  used 1

First bytes

l)__)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...
\n{s}sX>X<eu{h}sX>X<eu{\n}sX>X<{{XXXXXXX}seeseeseeW>{X<{|}%}%}%{|}sX>X<{{X}se...
SH+~+E+E+E+SH+~+H+E~+SH+~+H+E~+SI+~+H+D+D+SI+~+I+E+E+SH+~+H+E~+SF+~+E+SD+~+D+...
[33]`3=,3333=[33]`3=,388333=[8]`88=,8333=[8]`88=,8333=[8]`88=,8338=[8]`88=,33...
N:--25--22- 2-N:--25--22- 2-N:--22--22-N:--25--22- 2-N:--25--22- 2-N:--22--22...
776776777767c677676676677667c66677666676776c776776777767c7667776c666776666767...
'#('@('T(('k(('T((('k(('K('p(''((('@('T(('k(('T((('k(('k('M('#(('#('C('g('g((...
"?RiQiJo$?RiQijL!"Bf^
4YbZbAd/4YbZbaG*
0.99999999999999999
1

\n is newline in the second program.

Generator

"'#('@('T(('k(('T((('k(('K('p(''((('@('T(('k(('T((('k(('k('M('#(('#('C('g('g((((((((("

{_[i1:X;{_1&6+ \1$X*X5*:X;- 2/}16*;]__,,:)\f<Wf%10fb:c@#)<W%'c}%s

"67c"
"N:--22--22-
N:--25--22- 2-
N:--55--25--5--2--2-"N/ers

"N:-25 "
"[33]`3=,3333=
[33]`3=,388333=
[8]`88=,8333=
[8]`88=,8338=
[8]`88=,333=
[8]`88=,88="N/ers

"[]`38=,"
"SH+~+E+E+E+
SI+~+H+D+D+
SI+~+I+E+E+
SH+~+H+E~+
SI+~+I+D~+H+E~+
SF+~+E+
SD+~+D+D~+"N/ers

"SDEFHI+~"
"{s}sX>X<eu
{t}sX>X<{{XXXXXXXX}s{X}s{XXXXXX}erseeW>{X<{&}%}%}%
{ee}sX>X<eu
{&}sX>X<{{XXXXXXs}s{X}s{XXXXXX}erseeW>{X<{|}%eu}%}%
{h}sX>X<eu
{h}sX>X<eu{X|}%
{N}sX>X<{{XXXXXXX}seeseeseeW>{X<{|}%}%}%
{|}sX>X<{{X}seeW>{X<{|}%}%}%"N/'Nf/Nf*erN\+s

1>"l)_"o)\{'_oi10-')*o'\o}/i10-')*o

jimmy23013

Posted 2018-05-28T10:52:26.440

Reputation: 34 042

3

APL (Dyalog), 2 chain, 15+2 = 17 bytes

⎕AV[2+⎕AV⍳'⍳.']

Try it online!

Outputs the program

*0

That outputs

1

Uriel

Posted 2018-05-28T10:52:26.440

Reputation: 11 708

3

JavaScript (ES6), 2 functions, 31+4 = 35 bytes

function(){return atob`Xz0+MQ`}

returns _=>1, which returns 1

f0 =
function(){return atob`Xz0+MQ`}

res0 = f0()
console.log('Output of 1st function:', res0)

f1 = eval(res0)
res1 = f1()
console.log('Output of 2nd function:', res1)

Arnauld

Posted 2018-05-28T10:52:26.440

Reputation: 111 334

Wouldn't function invocation have to be part of each program? – TehShrike – 2018-05-28T17:47:13.730

@TehShrike Functions were explicitly allowed in the rules. (A function + its invocation code would be a full program. So, I don't think that would make much sense.) – Arnauld – 2018-05-28T17:57:09.617

Oh good call, I missed that – TehShrike – 2018-05-28T20:17:52.663

3

Java 8, 3 programs, 431 bytes

Program 1, 332 bytes

A lambda from one (empty) parameter of any type to String.

x\u002D\u003E"\151\156\164\40\157\75\70\46\70\52\70\54\156\75\53\53\157\53\70\73\156\145\167\40\123\164\162\151\156\147\50\51\53\50\143\150\141\162\51\50\47\171\47\53\157\51\53\50\143\150\141\162\51\50\47\54\47\53\157\51\53\50\143\150\141\162\51\50\47\75\47\53\157\51\53\156\53\50\143\150\141\162\51\50\47\56\47\53\157\51\53\156\73"

This is just a lambda with the arrow characters Unicode-escaped returning the text of the second program encoded with octal escape sequences.

Try It Online

Program 2, 93 bytes

Snippet producing a String.

int o=8&8*8,n=++o+8;new String()+(char)('y'+o)+(char)(','+o)+(char)('='+o)+n+(char)('.'+o)+n;

Try It Online (with return added)

Program 3, 6 bytes

A lambda from one (empty) parameter of any type to int.

z->9/9

Try It Online

Jakob

Posted 2018-05-28T10:52:26.440

Reputation: 2 428

2

Nice answer! You can golf \166 to \44 for -1 byte, since $ is also a valid variable name. Try it online, resulting in $->9-8 (Try it online.)

– Kevin Cruijssen – 2018-05-29T11:45:04.787

After several tries, it's just not possible to make a 3-chain with Java. You need the \uXXXX in the first code to avoid ->. Then you need either return (function) or System.out (snippet or function), both contain a u which you already used in \uXXXX. So I personally think this entry is invalid and I downvoted it accordingly. – Olivier Grégoire – 2018-05-30T15:25:57.513

@OlivierGrégoire Snippets are explicitly allowed in this challenge (first rule). In addition, System.console().printf could be used to prevent the use of u. Something similar is done in this answer and I've also used it in these two answers of mine.

– Kevin Cruijssen – 2018-05-30T15:45:07.000

Thanks @KevinCruijssen but a snippet must still output. Here's a fix around all: x->"\146\157\162\50\143\150\141\162\40\44\72\156\145\167\40\143\150\141\162\133\135\173\47\171\47\54\47\54\47\54\47\75\47\54\47\70\47\54\47\56\47\54\47\70\47\175\51\123\171\163\164\145\155\56\143\157\156\163\157\154\145\50\51\56\160\162\151\156\164\146\50\53\53\44\53\156\145\167\40\123\164\162\151\156\147\50\51\51\73" (319 bytes) turns into for(char $:new char[]{'y',',','=','8','.','8'})System.out.printf(++$+new String()); (89 bytes) turns into z->9/9 (6 bytes). Total: 404 bytes. – Olivier Grégoire – 2018-05-30T16:08:18.360

I meant System.console() for the 2nd program, which is correctly 89 bytes (while the System.out makes it 83 bytes). – Olivier Grégoire – 2018-05-30T16:26:02.880

Hi folks. @OlivierGrégoire take a look at this example that was posted by OP to show acceptable snippets. The second-last snippet neither returns nor prints its output.

– Jakob – 2018-05-30T17:17:09.963

Ok, I yield. Then this makes everything shorter: var r=new String();for(char $:new char[]{'8','.','8'})r+=++$; (61 bytes), and the first program can be as simple as "..." instead of encoding ->. – Olivier Grégoire – 2018-05-30T19:05:40.510

Also, just for fun, you can reflectively get a reference to System.out without using u, which is what another, no-snippet, 3-chain of mine does. – Jakob – 2018-05-30T21:08:14.207

3

Jelly,  38 37 36  35 bytes, Chain of 4

ØJiⱮ⁾ɱṾ⁽÷ṃ;ṾØJ⁽¡Ṡị

Try it online! (18 bytes)

8220,163,187Ọ

Try it online! (13 bytes)

“£»

Try it online! (3 bytes)

!

Try it online! (1 byte)

18+13+3+1=35 bytes

How?

ØJiⱮ⁾ɱṾ⁽÷ṃ;ṾØJ⁽¡Ṡị - Main Link: no arguments
    ⁾ɱṾ            - list of charcters -> ['ɱ','Ṿ']
ØJ                 - yield the characters of Jelly's code-page
   Ɱ               - Ɱap across the two characters applying:
  i                -   first index of? -> [163, 187]
       ⁽÷ṃ         - 8220 (a base 250 compressed number)
          ;        - concatenate -> [8220, 163 187]
           Ṿ       - un-eval (get Jelly code) -> "8220,163,187"
                   - (Note: here a full program prints 8220,163,187 as it is the end
                   - of a leading constant chain due to the following constant)
            ØJ     - yield the characters of Jelly's code-page
              ⁽¡Ṡ  - 1206 (a base 250 compressed number)
                 ị - index into (1-indexed & modular, so gets the 182nd item, 'Ọ')
                   - implicit print (making the final output 8220,163,187Ọ)

8220,163,187Ọ - Main link: no arguments
8220,162,187  - list of numbers -> [8220, 162, 187]
            Ọ - cast ordinals to characters -> ['“','£','»']
              - implicit print (flat Jelly lists print as if strings so outputs “£»)

“£» - Main link: no arguments
“   - open string-literal
 £  - the content of the string-literal
  » - close it interpreting as a compressed string
    - this yields ['!']
    - implicit print (outputs !)

! - Main link: no arguments
! - factorial (of implicit input 0 - 0! = 1 as it is the empty product)
  - implicit print (outputs 1)

Jonathan Allan

Posted 2018-05-28T10:52:26.440

Reputation: 67 804

3

Python 2, 3 snippets, 68 + 12 + 3 = 83 bytes

chr(44*2+4).join([chr(42&54),`45+25`,`42*2+52`,`4*4+55`+chr(42&54)])

which produces the string of octal literals:

"\70\136\71"

which produces:

8^9

Which finally produces 1.

Try it online!

Jo King

Posted 2018-05-28T10:52:26.440

Reputation: 38 234

2

SmileBASIC, chain 3, 375 bytes

k=59599-44444print c("sbanm",k,4,"")+c("sbwav",44-5,2,"")+c("sbwav",594-222,4,"")+c("game5vs",4528-442,2,"")+c("sbanm",k,4,"")+c("sbanm",72,5-4,"")*2+c("sbwav",594-222,4,"")+c(sbwav,854-44,2,"")+c("staffroll",259+2,9,"")+c("ex8techdemo",24455,5-2,"")+key(4)[.]def c(f,s,l,q)for i=.to-5+l+4q=q+load("txt:sys/"+f,.)[s+i]next:return q:end

Outputs:

CHR$63OUT A$CHR$33OUT B$PRINT A$;B$;L

Outputs:

?!0

Outputs:

1

12Me21

Posted 2018-05-28T10:52:26.440

Reputation: 6 110

2

PHP 7.0, 2-chain, 35 + 8 = 43 bytes

While writing my initial answer I realized I could just use base64 encode the second echo. It shaved off 11 bytes, so here it is. You can find my original idea below, too.

Run using php -r:

echo base64_decode('RUNITyAxPz4=');

This outputs:

ECHO 1?>

Which then obviously prints:

1

Output:

Code run with additional && echo for readability
My code when run in a terminal. The appended && echo is for readability only.

Comments:

There's not much to it really. Very simple once you know about "?>" implicitly acting as ";". The "tricky" part was to figure out what to encode:

  • ECHO 1; became RUNITyAxOw==, so we have a collision of uppercase O's. No good.
  • echo 1; became ZWNobyAxOw==, so now there's two lowercase o's. Unfortunate!
  • ECHO 1?> became RUNITyAxPz4=. It's the same length and none of the characters collide. So that's it!

Alternatively we can use "echO" and "ECHo", too (36 + 7 = 43 bytes).

echO base64_decOde('RUNIbyAxOw==')?>
ECHo 1;
1

We can also switch the ; and ?> around using that. It works equally well and it all scores the same in length.



My initial solution:

PHP 7.0, 2-chain, 44 + 10 = 54 bytes

This is the best I could come up with at first. I understood that "unique characters" meant "echo" is not equal to "ECHO". Hope I got that right!

Run using php -r:

echo strtoupper(urldecode('echo true%3b'))?>

This outputs:

ECHO TRUE;

Which in turn gives us our number:

1

Output:

Code run with additional && echo for readability
My code when run in a terminal. The appended && echo is for readability only.

Some comments:

  • I think you can only do a 2-chain in PHP since it requires the ";" instruction separator.
    • You can get around this once by using "?>", which implies a semicolon, but obviously can't re-use it a second time
    • This was the hardest part for me to figure out. I didn't know this worked beforehand, nor that "?>" was even allowed when running via php -r
  • By using strtoupper() I was able to just write the code for chain #2 in lowercase, while the output is obviously uppercase. Easy mode right there!
  • urldecode() allows me to encode ";" as "%3b"
  • That's all there is really, nothing too exciting

Thanks for the challenge, I learned something today!

Maz

Posted 2018-05-28T10:52:26.440

Reputation: 191

2

Lua, 2 chain, 83+8=91 bytes

load(('').char(0x70,0x72,0x69,0x6E,0x74,39,0x70,0x72,0x69,0x6E,0x74,34,49,34,39))()

Outputs

print"1"

Which outputs

1

GalladeGuy

Posted 2018-05-28T10:52:26.440

Reputation: 101

1

Charcoal, 2 programs, 10 + 2 = 12 bytes

⭆´G´·℅⊕⊕℅ι

Try it online! Outputs

I¹

Try it online! Which outputs 1.

Neil

Posted 2018-05-28T10:52:26.440

Reputation: 95 035

1

Braingolf, 2 chain, 9 + 2 = 11 bytes

72-_#23-@

Try it online!

This outputs

5/

Try it online!

(Plus some default output which can be ignored per OP's rules)

This in turn outputs

1

Skidsdev

Posted 2018-05-28T10:52:26.440

Reputation: 9 656

1

Röda, 2 chain, 31 + 3 = 34 bytes

Snippet 1:

(`X.Z`/"")|ord _|push _+3|chr _

Try it online!

Snippet 2:

[1]

Try it online!

They are snippets, because every valid Röda program must include main{...} bloat. They are also valid Röda REPL programs.

fergusq

Posted 2018-05-28T10:52:26.440

Reputation: 4 867

1

dc, 3 programs, 48 bytes

First:

82 2-adAArdAAI2*-rAAI-I2/2^-f

Yields the second:

75
P
90
P
110
P

Yields the third:

KZn

Yields 1.

Try it online! (has some stack-clearing and newline-printing code thrown in to make all three bits run in one go).

Perhaps best to start at program three, KZn. There are only a few ways to print things in dc, and I realized at this stage I would probably be stuck with either p or n, both of which are in the 100s in decimal ASCII. This means that I was almost certainly going to have to generate 1 instead of just using the program 1n. K pushes the current (default: 0) precision to the stack, and Z pushes the number of digits of top-of-stack, which gives us the 1 to print.

The second program is pretty straightforward. P prints the character with the given ASCII value, so we print 75 (K) 90 (Z) and finally 110 (n), which works wonderfully. It also means that, aside from the aforementioned 1, I can't use the digits 5, 7, 9, or 0 elsewhere. I also need a method other than P for turning numbers into characters.

The first program, then, has to make four numbers without using the digits 1, 5, 7, 9, or 0. It needs to make 80 (ASCII value of P): 82 2-; 75: AA (110) I- (subtract the default input radix, 10) I2/ (so, 5) 2^ (so, 5^2, 25) - (75); 90: AA (110) I2* (twice the default input radix of 10, so 20) - (90); and 110: well, it's just AA. After making 80, we use a to convert a number to a string. There are some reverse and duplicate commands in there to put the Ps in the right spots, and then finally we print the whole stack with f.

I'm pretty sure I didn't screw this up, but I did have my head spinning a little bit...

brhfl

Posted 2018-05-28T10:52:26.440

Reputation: 1 291

1

05AB1E, 5 + 3 = 8 bytes

ght<n

Try it online!

which right off the bat returns

I am taking the output 1.0 as not equalling 1, so I run that code:

1.0

Try it online!

which returns

1

And there you go!

Number of programs = 2

Caleb Evans

Posted 2018-05-28T10:52:26.440

Reputation: 11

Welcome to PPCG. – Muhammad Salman – 2018-06-02T15:45:23.770

I just tried to write random things and see what i get. Also, one might use a turing machine program. – Caleb Evans – 2018-06-02T17:19:47.133

You can remove the h (convert to hexadecimal). The g (get length, default 0) with t (square-root) already gives a decimal 0.0. With < (decrease by 1) it becomes -1.0 and then n (square) changes this into 1.0. You could also replace the <n with > (increase by 1). ;) So in total it's 3 bytes (gt>). Alternatively you could use Xt (1 and square-root). PS: I'm not sure if 1.0 to 1 is a valid part of the chain. I've asked OP to verify. Welcome to PPCG and enjoy your stay. – Kevin Cruijssen – 2018-06-04T15:06:45.787

well, computers process the string '1.0' differently than '1'. – Caleb Evans – 2018-06-09T23:54:37.480

0

Ruby, 2-chain, 24+3 = 27 bytes

$><<(''<<56+56<<' '<<49)

Output is

p 1

G B

Posted 2018-05-28T10:52:26.440

Reputation: 11 099