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.


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


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

  • \$\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


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


Try it online!

which prints the program


Try it online!

which prints the program

522472 2-255B

Try it online!

which prints the program


Try it online!

which prints the program


Try it online!

which prints 1

  • \$\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

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


Which is equivalent to:


-57 bytes thanks to @OlivierGrégoire.

Try it online.

Which returns the String:


Try it online.

Which returns the integer:

  • \$\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

R, 3-chain 198 + 44 + 3 bytes


Try it online!

Returns :


Try it online!

Returns :


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 :


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


Try it online!



Try it online!

Returns 1.

  • \$\begingroup\$ Nice one! Is cat mandatory? \$\endgroup\$ – JayCe May 29 '18 at 13:29
  • 2
    \$\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

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



print 1

Try it online!

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


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


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


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

Octave, 3 programs, Length 42 bytes


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

[[63 24]*2 '']

Outputs: ~0. Try it online!


Outputs: 1. Try it online!


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

Snippet 1:


Snippet 2:

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

Snippet 3:


Snippet 4:


Which then prints 1.

Try it online!


  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!

  • \$\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

Excel, Chain 2, 27+3 bytes


Not sure if this is OK...

  • 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

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.


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


xor eax,eax                      
inc eax                          

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.


JavaScript REPL, lots of bytes, 4 iterate


Too lazy to optimize the JSFUCK code

JavaScript REPL, 164 bytes, 3 iterate

may be able to expand


Try it online!

  • \$\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

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

This 92365-byte program prints


which prints

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

which prints


which prints


which prints


which prints


which prints 1.


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!


Try it online!


Try it online!


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.

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.


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

N:--25--22- 2-N:--25--22- 2-N:--22--22-N:--25--22- 2-N:--25--22- 2-N:--22--22...

\n is newline in the second program.



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

N:--25--22- 2-

"N:-25 "




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


Try it online!

Outputs the program


That outputs


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)

  • \$\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

Jelly,  38 37 36  35 bytes, Chain of 4


Try it online! (18 bytes)


Try it online! (13 bytes)


Try it online! (3 bytes)


Try it online! (1 byte)

18+13+3+1=35 bytes


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

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


which produces the string of octal literals:


which produces:


Which finally produces 1.

Try it online!


Java 8, 3 programs, 431 bytes

Program 1, 332 bytes

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


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.


Try It Online

  • 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

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







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:



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


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;

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:


Which in turn gives us our number:



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!


Lua, 2 chain, 83+8=91 bytes




Which outputs


Charcoal, 2 programs, 10 + 2 = 12 bytes


Try it online! Outputs


Try it online! Which outputs 1.


Braingolf, 2 chain, 9 + 2 = 11 bytes


Try it online!

This outputs


Try it online!

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

This in turn outputs


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

Snippet 1:

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

Try it online!

Snippet 2:


Try it online!

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


dc, 3 programs, 48 bytes


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

Yields the second:


Yields the third:


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


05AB1E, 5 + 3 = 8 bytes


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:


Try it online!

which returns


And there you go!

Number of programs = 2

  • \$\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

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

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

Output is

p 1

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.