Evolution of Powers of Two

This is a repost of Evolution of “Hello World!”, originally written by user Helka Homba

It should not be closed as a duplicated, due to meta consensus here.

The original was asked over two years ago and was last active more than six months ago. I have permission from Helka Homba to post this here

Since the original, many languages have been invented, and many people have joined the site who have never had an opportunity to answer the original, so I feel that this repost is acceptable.

The challenge is to make a program that prints 2^n to stdout, where n is the number of your program. The catch is that your program must have a Levenshtein distance of 10 or less from the program in the answer submitted before yours.

How This Will Work

Below I will submit the first answer using C#, which prints 2^(n=1)=2.

The next person to answer must modify the code with up to 10 single character insertions, deletions, or substitutions so that when it is run in the language of the new answer, it prints 2^n (with n being the answer number). For example, the 25th answer (let's say it's in Pyth) would print 2^25, or 33554432.

This will continue on until everyone get stuck because there is no new language the last answer's program can be made to run in by only changing 10 characters. The communal goal is to see how long we can keep this up, so try not to make any obscure or unwarranted character edits (this is not a requirement however).

Formatting

#Answer N - [language]

[code]

[notes, explanation, observations, whatever]


Where N is the answer number (increases incrementally, N = 1, 2, 3,...).

You do not have to tell which exact characters were changed. Just make sure the Levenshtein distance is from 0 to 10.

If you answer in some language or the resulting code is just a mess, do please explain what you did and why it works, though this isn't required.

Rules

There should never be two answers with the same N. If two people happen to simultaneously answer for some N, the one who answered later (even if it's a few seconds difference) should graciously delete their answer.

Furthermore...

• A user may not submit two answers in a row. (e.g. since I submitted answer 1 I can't do answer 2, but I could do 3.)
• Try to avoid posting too many answers in a short time frame.
• Each answer must be in a different programming language.
• You may use different major versions of a language, like Python 2/3
• Languages count as distinct if they are traditionally called by two different names. (There may be some ambiguities here but don't let that ruin the contest.)
• You do not have to stick to ASCII, you can use any characters you want. Levenshtein distance will be measured in unicode characters.
• The output should only be 2^n and no other characters. (Leading/trailing whitespace is fine, as is unsuppressible output like >>> or ans=)
• If your language doesn't have stdout use whatever is commonly used for quickly outputting text (e.g. console.log or alert in JavaScript).
• When the power of two you have to output gets very large, you may assume infinite memory, but not an infinite integer size. Please be wary of integer overflows.
• You may make use of scientific notation or whatever your languages most natural way of representing numbers is. (Except for unary, DO NOT output in unary)

Don't edit answers unless absolutely necessary.

Scoring

Once things settle down, the user who submits the most (valid) answers wins. Ties go to the user with the most cumulative up-votes.

Edit these when you post an answer:

Okx

zeppelin

Pavel
Jonathan Allan
Kritixi Lithos
Riker

boboquack

2 languages

bmarks
Conor O'Brien
Destructible Watermelon
ovs
Tom Carpenter

1 language

ATaco
Blocks
Dennis
dzaima
Erik the Outgolfer
ETHproductions
ghosts_in_the_code
Leo
Lynn
Matheus Avellar
Nathaniel
Qwerp-Derp
R. Kap
Taylor Scott
nimi
Mistah Figgins
PidgeyUsedGust
steenbergh

Languages used so far:

1. C# (Pavel)
2. /// (boboquack)
3. Retina (Dennis)
4. Jelly (Jonathon Allan)
5. Pyth (boboquack)
6. ><> (Destructible Watermelon)
7. Minkolang (Kritixi Lithos)
8. Perl (Pavel)
9. Python (Qwerp-Derp)
10. dc (R. Kap)
11. Charcoal (Jonathon Allan)
12. Self Modifying BrainFuck (Leo)
13. SOGL (dzaima)
14. ShapeScript (Jonathon Allan)
15. Pyke (boboquack)
16. Ruby (Nathaniel)
17. 05AB1E (ovs)
18. STATA (bmarks)
19. bc (Kritixi Lithos)
20. Japt (Okx)
21. 2sable (Kritixi Lithos)
22. Cheddar (Jonathon Allan)
23. Pylons (Okx)
24. Bash (zeppelin)
25. Pushy (Okx)
26. CJam (Erik the Outgolfer)
27. MATL (Okx)
28. MATLAB (Tom Carpenter)
29. Octave (Kritixi Lithos)
30. R (ovs)
31. JavaScript ES7 (Tom Carpenter)
32. Convex (Okx)
33. Mathematica (ghosts_in_the_code)
34. Pip (Okx)
35. Stacked (Conor O'Brien)
36. GolfScript (Okx)
37. Actually (Lynn)
38. RProgN (Okx)
39. Scheme (bmarks)
40. Element (Okx)
41. J (Blocks)
42. Cubix (ETHproductions)
43. zsh (zeppelin)
44. VBA (Taylor Scott)
45. Fish (zeppelin)
46. Reticular (Okx)
47. Perl 6 (Pavel)
48. RProgN2 (ATaco)
49. PHP (Matheus Avellar)
50. Jolf (Conor O'Brien)
52. Befunge-98 (Mistah Figgins)
53. Gnuplot (zeppelin)
54. QBIC (steenbergh)
55. FOG (Riker)
56. Qwerty-RPN (Okx)
57. Korn Shell (ksh) (zeppelin)
58. Julia (Riker)
59. Python 3 (Pavel)
60. Vimscript (Riker)
61. Dash (zeppelin)
62. Vitsy (Okx)
63. csh (zeppelin)
64. Ohm (Okx)
65. Bosh (zeppelin)
66. es-shell (Riker)
67. Gol><> (PidgeyUsedGust)

This question works best when you sort by oldest.

• A snippet would really be nice – Kritixi Lithos Feb 26 '17 at 6:58
• @KritixiLithos I don't know how to do those, feel free to edit one in though! – Pavel Feb 26 '17 at 6:59
• @TomCarpenter that is acceptable, I'm going to make the edit. – Pavel Feb 26 '17 at 18:53
• Does "Levenshtein distance will be measured in UTF-8 characters" mean that the edit distance is computed between strings of Unicode codepoints (and the "UTF-8" is a red herring, since in this sense it doesn't matter whether you use UTF-8, UTF-16, UCS4 or something else)? – Sami Liedes Feb 27 '17 at 17:19
• @SamiLiedes pavel responded in chat, it's just unicode codepoints yeah. (i.e. if the code point is different, it's a character difference) – Rɪᴋᴇʀ Feb 28 '17 at 23:17

64º,;S)1'a"bc"<<x
2^63
x
#??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^
exit
@n.out (*2 32#e#a44******O@) //2 25)
"e
"2ej
:py print(2**60)
"%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~# System<.Console<.<.#1024print(2**53)--0;#0}}//4|#6904r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>


Added 64º,;S)1'a

Only the 64º, is actual code, the rest is just junk.

This program will print the correct output, but it will also ask for some STDIN after it has printed 264.

• How in the world has this gone on? Nice job. – David Archibald Apr 17 '17 at 4:54

Answer 17: 05AB1E, Distance of 3

#"Ａ#327;N<."$"/class HelloWorld {static void Main() 0{;n***~ # System<.Console<.<. #1024p#rint(512); #0}}//4| #β”6904”±r«"$2
puts 16384 8*


Try it online!

• Well done on exploiting the fact the 05AB1E doesn't throw errors. – Okx Feb 26 '17 at 11:32

#23#2ej
printf $[2**24] #'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~ # System<.Console<.<. #1024p#rint(512); #0}}//4| #ß”6904”±r«"$2
#puts 16384 8*di 2^18o8*'


Try It Online !

--2@2(#"#28@P2*Jp;math 2\^45#2^41 NB.(expt 2 39); ^ exit @n.out (*2 32#e#a44******O@)//2 25)#e#2ej#printf("% $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~# System<.Console<.<.#1024 print(2^51)--;#0}}//4|#6904r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>


Remove 2 NL, replace ^ at the beginning with -, prepend another -, delete * within the print, replace 2nd * with ^, overwrite 49with 51, insert -- after the print.

• You removed the newlines...i cri evry tim – Pavel Feb 27 '17 at 3:53
• seriously why did you remove the newlines – Destructible Lemon Feb 27 '17 at 3:53
• Because haskell comments are --, so it's a lower edit distance than prepending -- twice. – Pavel Feb 27 '17 at 3:54
• @DestructibleWatermelon: line comment -- is 2 bytes, removing NL just 1 – nimi Feb 27 '17 at 3:54

We van use the trampoline # to just append the code in reverse. By removing S)1'a the ; can be reused, needing only 6 characters to be added.

#64º,;n*:"C"
"bc"<<x
2^66
x
#??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^
quit()
@n.out (*2 32#e#a44******O@) //2 25)
"e
"2ej
:
py
p
riker
i
n
t
(2**60)
"%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#  Try it online! I think keeping the # allows for some other languages to use it as a commented line. • Just FWIW, if a bounty is given for the last answer your answer probably won't get it. The general winner of answer chaining challenges is either the last answerer that remains last for 1-2 wks, or the person with the most answers. – Rɪᴋᴇʀ Mar 14 '17 at 14:16 • Don't really care for the bounty — just thought it'd be a shame to let this die. – PidgeyUsedGust Mar 14 '17 at 16:14 Answer 4: Jelly distance 3 /class HelloWorld {static void Main() 0{ System.Console.Write(2); 0}}//4| 8Ḥ  Try it online! all insertions: 00Ḥ. 0{ and 0} are there to suppress parsing errors (pop from empty list due to the { and } being quicks that turn monads into dyads using the left and right argument respectively). Ḥ "unhalves" 8 to make 16. • Why does the first { (after class HelloWorld) not need a 0 before it, but the other two do? – Pavel Feb 26 '17 at 6:28 • Each line is parsed as a link (function) before anything runs, the final one being the entry point to the program. The parser would be fine without the () before the second open brace on the first line. The third line cannot start with a brace as there is no monad on which to act. – Jonathan Allan Feb 26 '17 at 6:36 Answer 5: Pyth 32 "/class HelloWorld {static void Main() 0{ System.Console.Write(2); 0}}//4| 8Ḥ  Prints the numeric literal 32, then the space between the 2 and the " suppresses printing of the (auto-completed) string literal. +4 characters - 32 " Try it on herokuapp Answer 6 - ><> 32""/class HelloWorld {static void Main() 0{;n***~ System.Console.Write(2); 0}}//4| 8Ḥ  replaced a space with ", the code pushes 3, 2, 4, then reverses, pushes 4,2,3, then pops 3 off the stack, and multiplies 2, 4, 4, 2, for 64, outputs it and halts Try it online Answer 3: Retina, distance 3 /class HelloWorld {static void Main() { System.Console.Write(2); }}//4| 8  Appended |\n8 (distance 3). Try it online! Answer 20: Japt, distance 8 2**20$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~ # System<.Console<.<. #1024p#rint(512); #0}}//4| #ß”6904”±r«"$2
#puts 16384 8*di 2^18*/


Try it online!

Modifications:

Changed 2^19 to 2**20 at the start of the program, to calculate the power (4)

Replaced # with $ on the first line so that everything past it is interpreted as JS (1) On the last line, removed the / and added a */ at the end of the program, so the comment takes up the whole program (3) • Sorry, my answer above was incorrect. The last digit should be 8 instead of 7. – bmarks Feb 26 '17 at 9:35 • @bmarks Thanks, edited. – Okx Feb 26 '17 at 9:35 Answer 27: MATL, distance 4 27W%2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß”6904”±r«"$2 #puts 16384 8*di 2^18o8*'  Try it online! Added 27W% Explanation:  W 2 to the power of 27 27 % Start of single line comment  Answer 50: Jolf, distance 10 ^2@2(#"#28@P2*Jp;math 2\^45#2^41 NB.(expt 2 39); ^ exit @n.out (*2 32#e#a44******O@)//2 25)#e#2ej#printf("%$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~
#    System<.Console<.<.#1024
print(2**49);#0}}//4|
print(2^51)--;#0}}//4|#6904r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>  Try it Online! Added '3k before the 2, and '2k*. between the 2 and @. -- does nothing, '3k2 puts 52 2s onto the stack, and '2k*.@ multiplies them together, prints the number, and exits Also, I added a d" after printf("% to make other people's lives easier, as I had 2 extra characters. It doesn't affect the Befunge-98 program. Answer 42: Cubix, distance 8 2^41 NB.(expt 2 39); ^ exit @ⁿ.óout (*2 32#e#a44******O@)//2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*  Try it online! The lert(2**31 in the middle was changed to 44******O@. Answer 60, Vimscript, distance 10 "bc<<<2^57 #x??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^ exit @n.out (*2 32#e#a44******O@) //2 25) "e "2ej :py print(2**60) "%d"$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024print(2**53)--0;#0}}//4|#6904r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>  Changed the 2 # on the start of the middle two lines to ", added a " in front of the first line, and :py<space> in front of the last line. For clarification: " is a line comment in vimscript (at least at the start of a line), and doesn't need to be matched. Vim can run python code, so this is really equivalent to asking python for the answer. • If this is running Python code, why doesn't this error, like everywhere? – Pavel Feb 27 '17 at 19:27 • @Pavel only the last line is run as python code. – Rɪᴋᴇʀ Feb 27 '17 at 19:27 • Sorry, made that comment before you fixed it. – Pavel Feb 27 '17 at 19:29 Answer 8: Perl #327;N.""/class HelloWorld {static void Main() 0{;n***~ # System.Console. print(256); #0}}//4| #8Ḥ  Exactly distance of 10: +4 # for comments, +1 newline after System.Console., +3 for transforming write into print, +2 for turning 2 into 256. I wasn't going to participate, but I wanted to make sure some regular langs were added before anything got too insane. Try it online! Answer 49: PHP, distance 6 <?#"#28@P2*Jp;math 2\^45#2^41 NB.(expt 2 39); ^ exit @n.óout (*2 32#e#a44******O@)//2 25)#e#2ej#printf("%$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~
#    System<.Console<.<.#1024
print(2**49);#0}}//4|
#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>  Added <? and ?> to open and close PHP tags, respectively. Replaced 48 with 49. # starts a comment on PHP, so nothing is considered except for <? print(2**49); ?>  Here's a screenshot of proper syntax highlihgting and output to help visualize: Answer 2: /// /class HelloWorld {static void Main() { System.Console.Write(2); }}//4  +4 chars - ///4 Try it online! • Regarding the answer you deleted: I changed the 8 hour requirement to a more subjective "Just try not to post too much". Feel free to undelete. – Pavel Feb 26 '17 at 6:47 • @Pavel I want to post another answer again! :P – boboquack Feb 26 '17 at 7:16 • @boboquack In regards to the edit to the question you just proposed: Different versions of the same language count as the same language. Listing "Python" alone under "Languages used..." seems to be good enough. – R. Kap Feb 26 '17 at 8:05 • @R.Kap Thanks, that actually wasn't what I intended to edit in. The browser just auto-saved an earlier unproposed edit of the post where I copied language names, just to notice you already edited in the language names. When I went to add the multi-posters to the list, my saved version came up without my knowing. – boboquack Feb 26 '17 at 8:08 Answer 7: Minkolang, Distance: 4 327;N.""/class HelloWorld {static void Main() 0{;n***~ System.Console.Write(2); 0}}//4| 8Ḥ  Try it online! I added 7;N. to the program. Basically 3, 2 and 7 are pushed to the stack and then 2 is raised to the seventh power using ;. This is then outputted as a Number and then the program stops on the . Answer 11: Charcoal, distance 5 Ａ#327;N.""/class HelloWorld {static void Main() 0{;n***~ # System.Console. 1024p#rint(512); #0}}//4| β2048  Try It Online! The uppercase Greek letters Ａ and β are variables which are assigned the ASCII characters following. The final value is implicitly printed. • Wait, why did you change yours to answer 10? Mine was the 10th answer. – R. Kap Feb 26 '17 at 7:35 • @R.Kap I have moved back to 11 with an edit like I made before. – Jonathan Allan Feb 26 '17 at 7:39 • Just a note, if you happen to use Charcoal in the future ⎚ (clear) is shorter – ASCII-only May 19 '17 at 11:34 • @ASCII-only Ah, right - thanks! – Jonathan Allan May 19 '17 at 17:35 Answer 10: dc, Distance of 5 #327;N.""/class HelloWorld {static void Main() 0{;n***~ # System.Console. 1024p#rint(512); #0}}//4| #8  Here is a valid dc program which outputs 1024. Try it online! • That's not how the challenge works, yours is the 10th answer and should print 2^10 – Leo Feb 26 '17 at 7:30 • @Leo Oh, sorry about that. That's what I get for not reading the post properly. EDIT: It has been updated – R. Kap Feb 26 '17 at 7:33 Answer 12: Self-modifying Brainfuck Ａ#327;N<.""/class HelloWorld {static void Main() 0{;n***~ # System<.Console<.<. 1024p#rint(512); #0}}//4| #β6904  Try it online! SMBF is just like brainfuck, except the source code is available on the tape to the left of the starting position. Here we have the number to print in reverse at the end of the code, and we do <. four times to print all four digits. I added a < before each . in the code (there were 3 of them), an extra <., and modified the final number. Distance should be 8. Answer 29: Octave, Distance: 1 disp(2^29)%2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß”6904”±r«"$2 #puts 16384 8*di 2^18o8*'  Try it online! All I had to do was to change the 28 to 29 Answer 31: JavaScript ES7, Distance 7 alert(2**31)//2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß”6904”±r«"$2 #puts 16384 8*di 2^18o8*'  ES7 supports the ** operator for power. You can try online here. Answer 33: Mathematica, distance 9 2^33 (*2 32#e#alert(2**31)//2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß”6904”±r«"$2 #puts 16384 8*di 2^18o8*'*)  Explanation Puts everything inside comments and outputs 2^33 Please verify that this answer is valid before putting your own because I am new at this and don't want to end up breaking the chain. Answer 37: Actually, distance 7 2:37@ⁿ.óout (*2 32#e#alert(2**31)//2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*  Replaced  36?# with :37@ⁿ.ó. Try it online! Answer 38: RProgN, distance 10 2 38 ^ exit @ⁿ.óout (*2 32#e#alert(2**31)//2 25)#e#2ej#printf$[2**24]#'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024p#rint(512);#0}}//4|#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*  Try it online! Replaced 2:37 with 2 38 ^ exit  (10) (note the trailing space) Explanation: 2 2 ^ to the power of 38 38 exit Stop the prgram  Answer 47: Perl 6, distance 10 #28@P2*Jp;math 2\^45#2^41 NB.(expt 2 39); ^ exit @n.óout (*2 32#e#a44******O@)//2 25)#e#2ej#printf("%$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~
#    System<.Console<.<.#1024
print(2**47);#0}}//4|
#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*  Perl 6 is considered distinct from Perl. I tried to set up C down the road by adding "% after printf, hopefully someone uses that. Try it online! Answer 48: RProgN2, distance 9 "#28@P2*Jp;math 2\^45#2^41 NB.(expt 2 39); ^ exit @n.óout (*2 32#e#a44******O@)//2 25)#e#2ej#printf("%$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~
#    System<.Console<.<.#1024
print(2**47);#0}}//4|
#ß6904±r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^  Added a " to the start which stopped everything from breaking, the [[[ at the end clears the memory, and 268*^ calculates the new answer. Implicitly printed. Try it online! • Are you sure this counts? I already posted an RProgN version 1 answer, and I don't think multiple versions of the same language are allowed. – Okx Feb 27 '17 at 0:05 • RProgN 2 is a full rework of RProgN 1, Much like how Perl 6 is considered different enough from Perl 5, this is considered valid. – ATaco Feb 27 '17 at 0:11 Answer 66, es (shell) + bc, distance 8 #64º,;S)1'a "bc"<<x 2^66 x #??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^ quit() @n.out (*2 32#e#a44******O@) //2 25) "e "2ej : py p riker i n t (2**60) "%d"$[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024print(2**53)--0;#0}}//4|#6904r"\$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>


Changed exit to quit(), and added iker after the first r`. I couldn't resist and I wanted to add 4 more characters.

• But we need to work towards a goal ;_; – Destructible Lemon Mar 1 '17 at 0:19
• That sounds like a distance of 8 to me. – Sami Liedes Mar 1 '17 at 8:42
• @SamiLiedes you're right, fixing. – Rɪᴋᴇʀ Mar 1 '17 at 14:31