35
\$\begingroup\$

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).

\$\endgroup\$
  • \$\begingroup\$ Related \$\endgroup\$ – Jo King May 28 '18 at 12:05
  • 1
    \$\begingroup\$ Somewhat related \$\endgroup\$ – Kevin Cruijssen May 28 '18 at 12:07
  • \$\begingroup\$ To make sure I understood: the programs may use comments, right? I mean, parts of code that are "useless" \$\endgroup\$ – Luis Mendo May 28 '18 at 13:00
  • 2
    \$\begingroup\$ Are 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.? \$\endgroup\$ – nneonneo May 29 '18 at 1:22
  • 3
    \$\begingroup\$ In 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? \$\endgroup\$ – Emigna May 29 '18 at 7:26

27 Answers 27

17
+250
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Magic Octopus Urn Jun 1 '18 at 0:43
  • \$\begingroup\$ @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. \$\endgroup\$ – Emigna Jun 1 '18 at 7:26
  • 2
    \$\begingroup\$ @MagicOctopusUrn: Your task may be a bit harder as I believe I have a 5-chain ;) \$\endgroup\$ – Emigna Jun 5 '18 at 16:21
  • 2
    \$\begingroup\$ @MagicOctopusUrn: I'll be happy to :) This was a very fun challenge! \$\endgroup\$ – Emigna Jun 5 '18 at 20:28
  • 1
    \$\begingroup\$ Congrats for getting the 5th chain! \$\endgroup\$ – Chromium Jun 19 '18 at 6:06
12
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ \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. \$\endgroup\$ – Olivier Grégoire May 30 '18 at 12:04
  • 1
    \$\begingroup\$ 39 bytes + 4 bytes \$\endgroup\$ – Olivier Grégoire May 30 '18 at 12:14
  • \$\begingroup\$ @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.) \$\endgroup\$ – Kevin Cruijssen May 30 '18 at 12:30
  • \$\begingroup\$ @OlivierGrégoire Correction, I've been able to golf it to 28+4 by using "\44\55\76" instead of "\u0076\u002D\u003E" \$\endgroup\$ – Kevin Cruijssen May 30 '18 at 12:33
  • \$\begingroup\$ Nice golfing on top of mine ;) I haven't checked the 3-chain answer yet. I'll do it right now. \$\endgroup\$ – Olivier Grégoire May 30 '18 at 12:35
9
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Nice one! Is cat mandatory? \$\endgroup\$ – JayCe May 29 '18 at 13:29
  • 1
    \$\begingroup\$ Well potentially you could have an output as a string with "wri\164e"(function args) to avoid a t or other similar encodings \$\endgroup\$ – Giuseppe May 30 '18 at 15:50
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ – JayCe Jun 4 '18 at 20:14
  • 2
    \$\begingroup\$ @digEmAll See BLT's comment to my answer to another challenge... I think there might be something here. \$\endgroup\$ – JayCe Aug 6 '18 at 13:25
  • 2
    \$\begingroup\$ I've made this answer a Community Wiki. Please feel free to add this with a little explanation. \$\endgroup\$ – ngm Aug 7 '18 at 13:37
8
\$\begingroup\$

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.

\$\endgroup\$
7
\$\begingroup\$

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
\$\endgroup\$
7
\$\begingroup\$

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!

\$\endgroup\$
6
\$\begingroup\$

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!

\$\endgroup\$
  • \$\begingroup\$ In snippet 2 you've reused the character 1 used in snippet 1 \$\endgroup\$ – digEmAll Jun 3 '18 at 10:47
  • \$\begingroup\$ 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. \$\endgroup\$ – Chromium Jun 4 '18 at 2:28
  • \$\begingroup\$ ah I see, thanks \$\endgroup\$ – digEmAll Jun 4 '18 at 5:45
5
\$\begingroup\$

Excel, Chain 2, 27+3 bytes

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

Not sure if this is OK...

\$\endgroup\$
  • 2
    \$\begingroup\$ Shouldn't there be a CHAR(61)& in the beginning as well for there to be a chain of 2? \$\endgroup\$ – Emigna May 28 '18 at 12:05
  • 5
    \$\begingroup\$ You should use french instead of english (CHAR become CAR, 3 bytes saved), not sure if another language reduce it more \$\endgroup\$ – Sefa May 28 '18 at 13:11
  • 1
    \$\begingroup\$ @Emigna But it seems typing --1 in a cell and hit enter, it would just show 1 on the screen... \$\endgroup\$ – tsh May 29 '18 at 2:39
  • \$\begingroup\$ @tsh: Hmm, yeah it seems like Excel adds the = implicitly if you type --1. \$\endgroup\$ – Emigna May 29 '18 at 6:37
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ – tsh May 29 '18 at 8:24
5
\$\begingroup\$

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.

\$\endgroup\$
5
\$\begingroup\$

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!

\$\endgroup\$
  • \$\begingroup\$ @JoKing I didn't use 1 in other pros, so the first 1 is program and the 2nd one is result \$\endgroup\$ – l4m2 May 29 '18 at 3:22
  • \$\begingroup\$ Aren't you reusing the {}s? \$\endgroup\$ – Neil May 30 '18 at 9:58
  • \$\begingroup\$ @Neil Fixed and optimized \$\endgroup\$ – l4m2 May 30 '18 at 10:38
  • \$\begingroup\$ "The chain ends the first time 1 is outputted." \$\endgroup\$ – 12Me21 May 31 '18 at 0:29
5
\$\begingroup\$

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.

\$\endgroup\$
5
\$\begingroup\$

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!

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.
\$\endgroup\$
4
\$\begingroup\$

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
\$\endgroup\$
3
\$\begingroup\$

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

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

Try it online!

Outputs the program

*0

That outputs

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

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)

\$\endgroup\$
  • \$\begingroup\$ Wouldn't function invocation have to be part of each program? \$\endgroup\$ – TehShrike May 28 '18 at 17:47
  • \$\begingroup\$ @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.) \$\endgroup\$ – Arnauld May 28 '18 at 17:57
  • \$\begingroup\$ Oh good call, I missed that 👍 \$\endgroup\$ – TehShrike May 28 '18 at 20:17
3
\$\begingroup\$

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)
\$\endgroup\$
3
\$\begingroup\$

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!

\$\endgroup\$
3
\$\begingroup\$

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

\$\endgroup\$
  • 2
    \$\begingroup\$ 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.) \$\endgroup\$ – Kevin Cruijssen May 29 '18 at 11:45
  • \$\begingroup\$ 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. \$\endgroup\$ – Olivier Grégoire May 30 '18 at 15:25
  • \$\begingroup\$ @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. \$\endgroup\$ – Kevin Cruijssen May 30 '18 at 15:45
  • \$\begingroup\$ 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. \$\endgroup\$ – Olivier Grégoire May 30 '18 at 16:08
  • \$\begingroup\$ I meant System.console() for the 2nd program, which is correctly 89 bytes (while the System.out makes it 83 bytes). \$\endgroup\$ – Olivier Grégoire May 30 '18 at 16:26
2
\$\begingroup\$

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
\$\endgroup\$
2
\$\begingroup\$

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!

\$\endgroup\$
2
\$\begingroup\$

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
\$\endgroup\$
1
\$\begingroup\$

Charcoal, 2 programs, 10 + 2 = 12 bytes

⭆´G´·℅⊕⊕℅ι

Try it online! Outputs

I¹

Try it online! Which outputs 1.

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

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
\$\endgroup\$
1
\$\begingroup\$

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.

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

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...

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

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

\$\endgroup\$
  • \$\begingroup\$ Welcome to PPCG. \$\endgroup\$ – Muhammad Salman Jun 2 '18 at 15:45
  • \$\begingroup\$ I just tried to write random things and see what i get. Also, one might use a turing machine program. \$\endgroup\$ – Caleb Evans Jun 2 '18 at 17:19
  • \$\begingroup\$ 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. \$\endgroup\$ – Kevin Cruijssen Jun 4 '18 at 15:06
  • \$\begingroup\$ well, computers process the string '1.0' differently than '1'. \$\endgroup\$ – Caleb Evans Jun 9 '18 at 23:54
0
\$\begingroup\$

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

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

Output is

p 1
\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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