35
\$\begingroup\$

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

Please format your post like this:

#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

The key thing to understand about this challenge is that only one person can answer at a time and each answer depends on the one before it.

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)

Please make sure your answer is valid. We don't want to realize there's a break in the chain five answers up. Invalid answers should be fixed quickly or deleted before there are additional answers.

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:

Leaderboard

13 languages

Okx

8 languages

zeppelin

4 languages

Pavel
Jonathan Allan
Kritixi Lithos
Riker

3 languages

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 Raine
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 Raine)
  45. Fish (zeppelin)
  46. Reticular (Okx)
  47. Perl 6 (Pavel)
  48. RProgN2 (ATaco)
  49. PHP (Matheus Avellar)
  50. Jolf (Conor O'Brien)
  51. Haskell (nimi)
  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.

\$\endgroup\$
15
  • 2
    \$\begingroup\$ A snippet would really be nice \$\endgroup\$
    – user41805
    Commented Feb 26, 2017 at 6:58
  • \$\begingroup\$ @KritixiLithos I don't know how to do those, feel free to edit one in though! \$\endgroup\$
    – Pavel
    Commented Feb 26, 2017 at 6:59
  • 1
    \$\begingroup\$ @TomCarpenter that is acceptable, I'm going to make the edit. \$\endgroup\$
    – Pavel
    Commented Feb 26, 2017 at 18:53
  • 1
    \$\begingroup\$ 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)? \$\endgroup\$ Commented Feb 27, 2017 at 17:19
  • 1
    \$\begingroup\$ @SamiLiedes pavel responded in chat, it's just unicode codepoints yeah. (i.e. if the code point is different, it's a character difference) \$\endgroup\$
    – Riker
    Commented Feb 28, 2017 at 23:17

70 Answers 70

1 2
3
1
\$\begingroup\$

Answer 68, Jellyfish, distance 10

PC68º,;n*:"C"
BBc"<<x
2**66
x
#??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.`#(expt 2 39); ^ 
qut()
@n.out (*2 32#e#a44******O@) //2 25)
"e
"2ej
:
py 
p
r1ker
s
n
t
(2**60)
"%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#

Try it online!

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

Answer 69, Vyxal, distance 6

`C68º,;n*:"C"
BBc"<<x
2**66
x
#??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^ 
qut()
@n.out (*2 32#e#a44******O@) //2 25)
"e
"2ej
:
py 
p
r1ker
s
n
t
(2**60)
"%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#`69E

Try it Online!

  • Added a backtick att tthe start and end
  • Appended 69E
  • Removed an existing backtick
\$\endgroup\$
1
  • \$\begingroup\$ haha 69 nice. ‎‎‎‎ \$\endgroup\$
    – lyxal
    Commented Mar 21, 2022 at 4:54
1
\$\begingroup\$

Answer 70 - Desmos, distance 8

`C68º,;n*:"C"
BBc"<<x
2**66
o=2^{70}
#??92a5*2p@^54┘#--2'3k:'2k*.@2(#"#28@P2*Jp;math 2\^45#2^41 NB.#(expt 2 39); ^ 
qut()
@n.out (*2 32#e#a44******O@) //2 25)
"e
"2ej
:
py 
p
r1ker
s
n
t
(2**60)
"%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#`69E

Try it on Desmos!

Changed line 4 from x to o=2^{70} (1 substitution + 7 insertions = distance of 8).

The entirety of this relies on the fact that Desmos treats all lines as distinct expressions/equations. That is, if lines 1 and 2 aren't defined by each other, then line 2 will still "run" even if line 1 causes an error.

Output is shown in the grey box next to a proper variable declaration, which is what happens on line 4 of the code. All others are basically junk due to various reasons. Line 4 had to be edited, though, because a stray x could display the line y=x on the graph.

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

Answer 14 ShapeScript, distance 9

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

Try it online!

Place everything in a string by enclosing between two 's, multiply that string by 0 with 0* then push the integers 1, 6, 3, 8, and 4 onto the stack, which then gets implicitly printed.

...should be ripe for a change to ...2*16384.

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

Answer 16: Ruby, distance 8

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

added 2 #'s, a newline and puts, and changed s to 4.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Glad to see I didn't stuff it up! :D \$\endgroup\$
    – boboquack
    Commented Feb 26, 2017 at 8:40
0
\$\begingroup\$

Answer 32: Convex, distance 7

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!

Added 2 32#e#.

Explanation:

2       Push 2
  32    Push 32
    #   Power
     e# Line comment
\$\endgroup\$
0
\$\begingroup\$

Answer 53, Gnuplot, distance 5

#--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#printf("%d" $[2**43]bye'$/*#"A#327;N<."$"/class HelloWorld {static void Main() 0{;n***~#    System<.Console<.<.#1024
print(2**53)--0;#0}}//4|#6904r"$2 #puts 16384 8*di 2^18o8*'*[[[268*^?>
\$\endgroup\$
0
\$\begingroup\$

Answer 56: Qwerty-RPN, distance 7

2 56^#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
#printf("%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 2 56^#x (7)

Explanation:

2       Push 2
 56     Push 56
   ^    Calculate exponent
    #   Print
     x  Terminate program

Unfortunately, there is no online interpreter for this language.

\$\endgroup\$
4
  • \$\begingroup\$ This should be answer 56. \$\endgroup\$
    – Riker
    Commented Feb 27, 2017 at 16:44
  • \$\begingroup\$ I didn't see the because if I look at the answer above, it says 54. Apparently 55 was posted before 54? It goes 50-55-51-52-53-54 sorted by oldest first. \$\endgroup\$
    – Okx
    Commented Feb 27, 2017 at 16:46
  • \$\begingroup\$ I posted a bad answer, then deleted it. I edited it into a good answer after, but that was after 4 other answers. Look at the rev history. \$\endgroup\$
    – Riker
    Commented Feb 27, 2017 at 16:47
  • \$\begingroup\$ @Riker well, I guess you messed up the order there! I'll edit my answer anyway. \$\endgroup\$
    – Okx
    Commented Feb 27, 2017 at 16:48
0
\$\begingroup\$

Answer 58: Julia, 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
print(2^58) #"%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*^?>

Try it online!

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

Answer 59, Python 3, Distance of 3

#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
print(2**59) #"%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*^?>
\$\endgroup\$
1 2
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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