title: Evolution of "Hello World!"

text:
# Question
Title: Evolution of "Hello World!"
***This contest is officially over, the winner is jimmy23013. Congratulations!***

The challenge is to make a program that prints `Hello World!` to stdout. The catch is that your program must have a Levenshtein distance of 7 or less from the program in the answer submitted before yours.

# How This Will Work

Below I have already submitted the first answer using Python: `print("Hello World!")`.

The next person to answer must modify the string `print("Hello World!")` with up to 7 single character insertions, deletions, or substitutions so that when it is run in any language that hasn't been used so far (only Python in this case) the output is still `Hello World!`.

For example the second answerer might use 1 substitution (`r -> u`), 2 deletions (`in`), and 1 insertion (`s`) to make the string `puts("Hello World!")` which prints `Hello World!` when run in Ruby.

The third person to answer must do the same thing in a new language, but using the program of the second person's answer (e.g. `puts("Hello World!")`) as their starting point. The fourth answer will be in relation to the third answer and so on.

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

# 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 only submit one answer per 8 hour period.** i.e. Each of your answers must be at least 8 hours apart. (This is to prevent users from constantly watching the question and answering as much as possible.)
* 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.)
* Each answer must be in a different programming language.
    + Different versions of the same language count as the same language.
    + 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 may only use tabs, newlines, and printable ASCII. (Newlines count as one character.)
* The output should only be `Hello World!` and no other characters (a leading/trailing newline is not an issue).
* If your language doesn't has stdout use whatever is commonly used for quickly outputting text (e.g. `console.log` or `alert` in JavaScript).

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

### Leaderboard: (out of date)

(user must have at least 2 valid answers)

> **11 Answers**

> **7 Answers**
>
> **6 Answers**
>
> **5 Answers**
>
> **4 Answers**
>
> **3 Answers**
>
> **2 Answers**

### Languages used so far:

> 1. Python
> 2. CJam
> 3. PHP
> 4. Pyth
> 5. Perl
> 6. Befunge 98
> 7. Bash
> 8. Nimrod
> 9. Ruby
> 10. GNU dc
> 11. Golfscript
> 12. Mathematica
> 13.
> 14. Lua
> 15. Sage
> 16. Julia
> 17. Scilab
> 18. JavaScript
> 19. VHDL
> 20. HyperTalk
> 21. Haskell
> 22. LOLCODE
> 23. APL
> 24. M30W
> 25. Stata
> 26. TI-BASIC (NSpire)
> 27. ActionScript 2
> 28.
> 29. PowerShell
> 30.
> 31. Visual FoxPro
> 32. VBA
> 33. Extended BF Type III
> 34. Zsh
> 35. Dash
> 36. Clojure
> 37. NetLogo
> 38. Groovy
> 39. CoffeeScript
> 40. Clipper
> 41. B.A.S.I.C.
> 42. FALSE
> 43. fish (shell)
> 44. GNU Octave
> 45. TCL
> 46.
> 47. newLisp
> 48. Lisp
> 49. SMT-LIBv2
> 50. Racket
> 51. Batsh
> 52. tcsh
> 53. AppleScript
> 54. Mouse
> 55. Pixie
> 56. F#
> 57. Falcon
> 58. Burlesque
> 59. HTML
> 60. SGML
> 61. M4
> 62. MUMPS
> 63. TeX
> 64. Forth
> 65. Salmon
> 66. Turing
> 67. bc
> 68. Betterave
> 69. Scheme
> 70. Emacs Lisp
> 71. Logo
> 72. AutoLISP
> 73. ///
> 74. Rebol
> 75. Maple
> 76. FreeBASIC
> 77. Vimscript
> 78. ksh
> 79. Hack
> 80. mIRC
> 81. Batch
> 82. Make
> 83. Markdown
> 84. sh
> 85. GDB
> 86. csh
> 87. HQ9+-
> 88. Postscript
> 89. Matlab
> 90. Oz
> 91. CASIO BASIC
> 92. VBScript
> 93. QBasic
> 94. Processing
> 95.
> 96. Rust 0.13
> 97. Dart
> 98. Kaffeine
> 99. Algoid
> 100. AMPL
> 101. Alore
> 102. Forobj
> 103. T-SQL
> 104. LiveCode
> 105. Euphoria
> 106. SpeakEasy
> 107. MediaWiki
> 108. SmallBASIC
> 109. REXX
> 110. SQLite
> 111. TPP
> 112. Geom++
> 113. SQL (postgres)
> 114. itflabtijtslwi
> 115. RegXy
> 116. Opal.rb
> 117. Squirrel
> 118. Pawn
> 119. Scala
> 120. Rebmu
> 121. Boo
> 122. PARI/GP
> 123. Red
> 124. Swift
> 125. BeanShell
> 126. Vala
> 127. Pike
> 128. Suneido
> 129. AWK
> 130. Neko
> 131. AngelScript
> 132. gosu
> 133.
> 134. ALAGUF
> 135. BogusForth
> 136. Flaming Thunder
> 137. Caché ObjectScript
> 138. owl
> 139. Cardinal
> 140. Parser
> 141. Grin
> 142. Kitten
> 143. TwoDucks
> 144. Asymptote
> 145. CAT
> 146. IDL
> 147. Tiny
> 148. WTFZOMFG
> 149. Io
> 150. MuPAD
> 151. Java
> 152. Onyx
> 153. JBoss
> 154. S+
> 155. Hexish
> 156. yash
> 157. Improbable
> 158. wake
> 159. brat
> 160. busybox built-in shell
> 161. gammaplex
> 162. KTurtle
> 163. AGOL 68
> 164. Alice
> 165. SML/NJ
> 166. OCaml
> 167. CDuce
> 168. Underload
> 169. Simplex v.0.6
> 170. Minkolang 0.9
> 171. Fexl 7.0.3
> 172. Jolf
> 173. Vitsy
> 174.
> 175. Retina
> 176. Codename Dragon
> 177. Seriously
> 178. Reng v.3.3
> 179. Fuzzy Octo Guacamole
> 180. 05AB1E

<sup>(Feel free to edit these lists if they are incorrect or out of date.)</sup>

This question works best when you sort by oldest.

*NOTE: This is a trial question for a new challenge type I have in mind where each answer depends on the last and increases in difficulty. Come discuss it with us in the chatroom for this question or in meta.*

# Answer
# Answer 85 - GDB (GNU Debugger)

```
#[]([.]c;main()&alert"  "
    echo Hello World!
#[;]:;#bye;dnl</vsh>

```

I think this can also be qualified as a programming language. It has even `if` and `while` commands.

`echo` is another built in command in GDB.

To run this code:

```
gdb --batch -x file

```

Distance: 7 from answer 84.
> 31 votes

# Answer
# Answer 1 - Python

```
print("Hello World!")

```

There's got to be dozens of languages this could morph into.
> 56 votes

# Answer
## Answer 59 - HTML

**What? No HTML ??**

```
<echo o[.]c;cat<<;#&&alert" ">Hello World!</vsh
```

Distance from Answer 58 : 6

**Voodoo Magic ? Nah. Here is how it works:**

You can have any arbitrary tag in HTML, so the first part `<echo o[.]c;cat<<;#&&alert" ">` is an `echo` tag, which now becomes a blank tag with no CSS applied by default by the browser.

The `o[.]c;cat<<;#&&alert" "` part is actually two properties set on that tag separated by space. So the first property has the key `o[.]c;cat<<;#&&alert"` and second key is `"` and both the values are blank.

Second part is just plain text `Hello World!` which is the text contents of the `echo` tag.

Next up, HTML tries to find the closing `echo` tag, but instead, finds a closing `vsh` tag. It then ignores the closing `vsh` tag (i.e. `</vsh`) and auto closes the `echo` tag.
> 48 votes

# Answer
# Answer 95 - C

```
//[]([.]c;
main()    {
    puts("Hello World!");}
//#[;]#bye;dnl</>

```

Distance 7 from answer 94
> 43 votes

# Answer
# Answer 151 - Java

```
//#
class jux{public static void main(String[] h){System.out.println(//;\#//Hello*}}print,
"Hello World!");}}//print"putsx;//-##[;]#bye</>%"

```

Distance from Answer 150 : 7

Try it here

(Thanks to Christopher Creutzig for being such a sport :) )
> 31 votes

# Answer
# Answer 22 - LOLCODE

```
VISIBLE "Hello World!"

```

Distance : 6
> 29 votes

# Answer
# Answer 10 - GNU dc

```
[puts "\x48][Hello World!]p

```

Distance: 6
> 27 votes

# Answer
# Answer 4 - Pyth

```
"Hello World!

```

This answer is a distance of 6 from the previous answer. Pyth strings do not need a closing quote if they are at the end of a line.
> 26 votes

# Answer
# Answer 11 - Golfscript

```
#[puts "\x48]
"Hello World!"

```

A distance of 5.
> 21 votes

# Answer
## Answer 83 - Markdown

**What ?? No Markdown ? :P**

```
[](#[.]c;cat;#&&alert"  "
    @echo)Hello World!
[;]:;#bye;dnl</vsh>

```

Try it here

Distance from Answer 82 : 7

```
e   -> [
:   -> ]
\n  -> (
o H -> o)H
:   -> [
#   -> ]
"   -> :

```

**Voodoo magic ?? Nah!! Here is how it works:**

* `[text](link)` creates a link.

So the first part of the code is

```
[](#[.]c;cat;#&&alert"  "
        @echo)

```

Which creates an empty text link with location

```
#[.]c;cat;#&&alert"  "
     @echo

```
* Next part `Hello World!` is printed as is
* Then `[;]:;#bye;dnl</vsh>` creates a reference link for `;` which can be used anywhere in the markdown.

Ex:

```
[Some text][;] // Outputs a link with text "Some text" and url ";#bye;dnl</vsh>"

```
> 21 votes

# Answer
# Answer 15 - Sage

```
print("Hello World!")

```

Distance = 6

Full circle.
> 19 votes

# Answer
# Answer 12 - Mathematica

```
#[puts];
"Hello World!"

```

Distance of 7. Attempting to clear up some of that mess.
> 18 votes

# Answer
# Answer 6 - Befunge 98

```
<@,kb"Hello World!"

```

Distance of 5 from the previous answer. There was originally a bug where the `k` wasn't there; I know it was there when I wrote this program, though. I guess it just didn't make it into this post.
> 17 votes

# Answer
## Answer 2 – CJam

```
"Hello World!"

```

This is a distance of 7 from the first answer

Try it online here
> 16 votes

# Answer
# Answer 19 - VHDL

```
report "Hello World!";

```

Distance: 6
> 16 votes

# Answer
# Answer 3 – PHP

```
<?="Hello World!"?>

```

This answer is a distance 5 from the second answer.
> 14 votes

# Answer
# Answer 23 - APL

```
 "Hello World!"

```

Note there's a leading space.
Distance: 7
> 14 votes

# Answer
# Answer 5 - Perl

```
print"Hello World!"

```

This answer is a distance 6 from the fourth answer.
> 13 votes

# Answer
# Answer 7 - Bash

```
echo Hello World!

```

This is a distance of 7 from the sixth answer.
> 13 votes

# Answer
## Answer 28 - J

```
]trace=:('Hello World!')

```

Distance = 5 from Answer 27
> 13 votes

# Answer
## Answer 33 - Extended BF Type III

```
a#="*#[.>]trac": "@Hello World!

```

Distance 7 from Answer 32

Well, I have not found an interpreter for that extension but the code seems to fit the specs of the language.

```
a //ignored
#="*# //comment
[.>] //print each character until an empty cell
trac" //ignored
: //move pointer, do not impact result
 " //ignored
@ //end of source
Hello World! //Injected in cells before execution

```
> 13 votes

# Answer
# Answer 100 - AMPL

```
#[][.]#i
#main()    {
    print("Hello World!");
#[;]#bye;dnl</>

```

Distance 6 from Answer 99
> 13 votes

# Answer
# Answer 8 - Nimrod

```
echo "\x48ello World!"

```

Distance of 6 from the last answer.
> 12 votes

# Answer
# Answer 14 - Lua

```
#[put
print("Hello World!")

```

Distance = 7
> 12 votes

# Answer
# Answer 21 - Haskell

```
putStrLn "Hello World!"

```

Distance: 7
> 12 votes

# Answer
## Answer 26 - TI-BASIC (NSpire)

```
Disp "Hello World!"

```

Distance: 5 from answer 25

(Tested on a TI-NSpire calculator)
> 12 votes

# Answer
## Answer 29 - MS Windows Powershell

```
#]trace=:(
'Hello World!'

```

Distance = 3 from Answer 28
> 11 votes

# Answer
# Answer 42 - FALSE

```
{#ah="*#[.>]trac";cat<<@
#&&alert
?} "Hello World!
"

```

Levenshtein distance from #41 is 7. Tested with this online implementation of FALSE. I used some leftover edit-distance slots to remove some cruft...
> 11 votes

# Answer
# Answer 150 - MuPAD

```
//#class jux{public static void main(String[] h){System.out.println(;\#//Hello*}}print,
"Hello World!"//print"putsx;//-##[;]#bye</>%"

```

Distance 6 from answer 149.

**EDIT**: Added “ h” to move the chain forward.
> 11 votes

# Answer
# Answer 30 - K

```
/#]trac
"Hello World!"

```

Distance: 7 from Answer 29

I think this works, an interpreter is here (Kona). `/` begins a one-line comment in K. I've cleaned up some of the `#]trace=:(` mess.
> 10 votes

# Answer
# Answer 73 - ///

```
/<vsh  o[.]c;cat;#&&alert"  "
(princ//Hello World!/);%!#bye";dnl</vsh>~

```

Distance 7 from answer 72.
> 10 votes

# Answer
# Answer 16 - Julia

```
println("Hello World!")

```

Distance from 15 = 2
> 9 votes

# Answer
# Answer 18 - JavaScript

```
alert("Hello World!");

```

---

Lev. Dist from A#17 = 5
> 9 votes

# Answer
## Answer 24 - M30W

```
say [Hello World!]

```

Distance: 5
> 9 votes

# Answer
# Answer 25 - Stata

```
display "Hello World!"

```

Distance: 6 (`[`-\> `"`, `]`-\> `"`, and addition of `di` and `pl`)
> 9 votes

# Answer
## Answer 27 - ActionScript 2

```
trace("Hello World!")

```

Distance: 7 (`Disp` -\> `trac` = 4, +`e(` = 2, +`)` = 1 = 4+2+1 = 7)

From Answer 26
> 8 votes

# Answer
## Answer 36 - Clojure

```
;ah="*#[.>]trac":;cat<<@
(pr"Hello World!"
)

```

Distance 7 from answer 35

`;` makes the rest of the line a comment, and `(pr "Hello World!")` does the printing
> 8 votes

# Answer
## Answer 60 - SGML

Heck, if HTML counts…

```
<vsh  o[.]c;cat;#&&alert" ">Hello World!</vsh>

```

Distance from Answer 59 : 7
> 8 votes

# Answer
# Answer 121 -

```
#{//-##[][/]#i--#main(){println(
#//sel/.*}}
print("Hello World!")
#;//"-##[;]#bye</>%"

```

Happy Halloween!

Distance 7 from Answer 120. Nothing fancy: added three `#` comment characters, and added `rint` after `p`.

Boo has syntax inspired by Python, but is a separate language with unique features built on the .NET CLI.
> 8 votes

# Answer
# Answer 9- Ruby

```
puts "\x48ello World!"

```

Distance: 4
> 7 votes

# Answer
# Answer 13 - R

```
#[puts];
cat("Hello World!")

```

Distance = 5
> 7 votes

# Answer
## Answer 20 - HyperTalk

```
answer "Hello World!"

```

Distance: 7
> 7 votes

# Answer
# Answer 31 - Visual FoxPro

```
*#]trac
? "Hello World!"

```

Distance: 3 from Answer 30

Not tested of course, but `*` begins a comment and `? "String"` prints `String`.
> 7 votes

# Answer
# Answer 32 - VBA

```
a="*#]trac":? "Hello World!"

```

Distance: 7 from Answer 31

Runs from the immediate window. The colon `:` is a line sepator that allows multiple lines of code to be written on the same line. (Anything run from the immediate window has to be a one liner.) The `?` is a shortcut for printing to the immediate window.
> 7 votes

# Answer
## Answer 70 - Emacs Lisp

```
;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in
(print "Hello World!") ;%!#bye";dnl</vsh>~

```

Distance of 7 from Answer 69. Didn't need any changes to compile, but cleans up a bit.
> 7 votes

# Answer
# Answer 96 - Rust 0.13

```
fn//[]([.]c;
main()    {
    print!("Hello World!");}
//#[;]#bye;dnl</>

```

Distance 6 from answer 95.
> 7 votes

# Answer
# Answer 107 - MediaWiki markup

```
{|--#[][.]#i--#main()   {puts(,
Hello World!
|--#[;]#bye;dnl</>"%

```

There is already HTML, SGML and Markdown. Why not MediaWiki?

You can see it here.

Distance 7 from Answer 106.
> 7 votes

# Answer
# Answer 167 - CDuce

```
(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

Distance 7 from Answer 166, removed `_string`

Nothing special, most difficult part was finding the language.

`(* *)` makes a multiline comment, `print` prints the string
> 7 votes

# Answer
# Answer 17 - Scilab

```
disp("Hello World!")

```

Distance = 6 to Answer 16
> 6 votes

# Answer
# Answer 50 - Racket

```
;@echo o#[.>]tac";cat<<;#&&alert
(print "Hello World!");\

```

Distance is 7 from the previous answer. Needs to be run in the shell.
> 6 votes

# Answer
# Answer 62 - MUMPS

```
;dnl<vsh  o[.]c;cat;#&&alert" ">
w "Hello World!";dnl</vsh>

```

Distance: 6
> 6 votes

# Answer
# Answer 88 - Postscript

```
%#[]([.]c;main()
    /eco (Hello World!)=
%#[;]:;#bye;dnl</>

```

Distance: 6 insertions to answer 87.

Back to real programming languages.
> 6 votes

# Answer
# Answer 120 - Rebmu

```
{//-##[][/]#i--#main(){println(
//sel/.*}}
p("Hello World!")
;//"-##[;]#bye</>%"

```

Distance 7 from Answer 119

* `{` and `}` are asymmetric string delimiters for an alternate representation of strings permitting balanced nested pairs, embedded quotes, etc. `{Hey {it's} "legal"}`. Add one at the beginning then two braces to create a balanced string after the `.*` **cost 3**
* Standalone string literals not passed to any function are skipped by the evaluator, so that literal has no effect.
* At the outset of the program, P is a single character abbreviation for PR, itself an abbreviation for PRINT. *(If you wanted you could overwrite it and use as a variable in code golf and still access printing through PR, and if you overwrite that you could use PRINT. Or set `X` to point to the function value of P before you override it, etc.)* **cost 1**
* Parentheses are structural elements that can be used for arbitrary purposes (imagine if Lisp had `[]` and `()` as different "flavors" of series you could metaprogram with, with `[]` having the traditional "list" behavior). In the default evaluator parens just do precedence, so there's no significance to putting it around a string literal. Added a paren instead of subtracting in case it would be helpful, either way it's **cost 1**
* Semicolon comments to end of line, get rid of last line using that with an insertion so that the comment comes after it. (Would have been 1 cheaper to do that with the first 2 lines but this is perhaps a better setup.) **cost 1**
* Spend extra random character to join println onto `main(){` **cost 1**
> 6 votes

# Answer
# Answer 168 Underload

```
(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
pint)(Hello World!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

Distance 7 from Answer 167
> 6 votes

# Answer
# Answer 34 - Zsh

```
ah="*#[.>]trac":;<<@
Hello World!
@

```

Distance: 7 from Answer 33.
> 5 votes

# Answer
Since I can't craft the solution I wanted to go with from the previous one, here's another solution instead:

# Answer 40 - Clipper

```
*#//;ah="*#[.>]trac":;cat<<@
&&alert
? "Hello World!"

```

**NB:** There is a trailing space at the end of line 2.
Distance: 6

Clipper is unique in that it has four different commenting techniques of which I've used two above:

```
* A comment
// A comment
&& A comment
/* A multiline
comment */

```

`?` is obviously the print command.
> 5 votes

# Answer
# Answer 48 - Lisp

```
;@echo o#[.>]trac";cat<<
;#&&alert
(princ "Hello World!");\

```

Distance = 7
> 5 votes

# Answer
## Answer 54 - Mouse

```
~//echo o[.>]c;cat<<;#&&alert (printf
"Hello World!"$

```

Distance 7 from Answer 53.
> 5 votes

# Answer
## Answer 61 - M4

```
dnl<vsh  o[.]c;cat;#&&alert" ">
Hello World!dnl</vsh>

```

Distance from Answer 60 : 7
> 5 votes

# Answer
# Answer 63 - TeX

```
%;dnl<vsh  o[.]c;cat;#&&alert" ">w "
Hello World!\bye";dnl</vsh>

```

Distance 7 from answer 62.
> 5 votes

# Answer
# Answer 67 - bc

```
#%# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in(
print "Hello World!" #%!#bye";dnl</vsh>

```

Distance: 7 from answer 66.
> 5 votes

# Answer
## Answer 69 - Scheme

```
;#%# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in
( print "Hello World!") ;%!#bye";dnl</vsh>~

```

Distance of 7 with Answer 68: addition of newline, deletion of `~`, newline and `$`, substitutions of `~` to `;`, `~` to `)` and `#` to `;`
> 5 votes

# Answer
## Answer 71 - Logo

```
;<vsh  o[.]c;cat;#&&alert" ">w ".in
(print [Hello World!];%!#bye";dnl</vsh>~

```

Distance of 7 from Answer 70.

Online Interpreter
> 5 votes

# Answer
# Answer 82 - Make

```
e:
#[.]c;cat;#&&alert"  "
    @echo Hello World!
:;#";#bye;dnl</vsh>

```

Distance 4 from Answer 81: add `e` `\t` del `;` sub `?`-\>`\n`
Tested on Ubuntu
> 5 votes

# Answer
# Answer 87 - HQ9+-

```
#[]([.]c;main()
    eco Hello World!
#[;]:;#bye;dnl</>

```

Distance 7 from answer 86.

Unlike Hello, H9+, HQ9+ and HQ9++, H9Q+- actually prints `Hello World!`. The creator's website clearly says so, and it offers an interpreter (standard untar-make approach) which I have tested.
> 5 votes

# Answer
# Answer 102 - Forobj

```
"--#[][.]#i
--#main()    {
    Print("%"Hello World!"d");
--#[;]#bye;dnl</>"%

```

Distance 7 from Answer 101. (added `""%d""%`)

An interpreter does not, in fact, exist. However, the code is fairly straightforward. It pushes a big string, then pops it (`"..."%`). It then pushes the string `"Hello World!"` and prints it (`d`). Lastly, it pushes another string and pops that one as well.
> 5 votes

# Answer
# Answer 162 - KTurtle

```
#class jux{public static void main(String[] h){#
#System.Console.Wrinteln(//@\//Hello*}}print,cat<<<
print"Hello World!"#X` ;}}//print#putsx;//-##E;]#bye</>%"

```

Distance 6 from Answer 161
> 5 votes

# Answer
# Answer 35 - Dash

```
ah="*#[.>]trac":;cat<<@
Hello World!
@

```

Distance 3 from answer 34.
> 4 votes

# Answer
## Answer 37 - NetLogo

```
;ah="*#[.>]trac":;cat<<@
type"Hello World!"

```

Distance 5 from from Answer 36
> 4 votes

# Answer
## Answer 38 - Groovy

```
//;ah="*#[.>]trac":;cat<<@
print"Hello World!"

```

7 distance from 37

Try it here
> 4 votes

# Answer
## Answer 39 - CoffeeScript

```
#//;ah="*#[.>]trac":;cat<<@
alert "Hello World!"

```

6 distance from 38

Try it here
> 4 votes

# Answer
# Answer 44 - GNU Octave

```
#ah="*#[.>]trac";cat<<
#&&alert
disp "Hello World!"

```

Levenshtein distance from #43: 5 (1 removed, 4 replaced)
> 4 votes

# Answer
## Answer 47 - newLisp

```
;#ah="*#[.>]trac";cat<<
;#&&alert
(print "Hello World!");\

```

distance = 7
> 4 votes

# Answer
## Answer 49 - SMT-LIBv2

```
;@echo o#[.>]trac";cat<<
;#&&alert
(echo "Hello World!");\

```

Distance = 5
> 4 votes

# Answer
# Answer 51 - Batsh

```
//echo o#[.>]tac";cat<<;#&&alert
println("Hello World!");

```

Distance = 7
> 4 votes

# Answer
# Answer 53 - Applescript

```
#//echo o[.>]tac;cat<<;#&&alert (printf
log"Hello World!"

```

Distance 6 from answer 52
> 4 votes

# Answer
## Answer 56 - F#

```
//echo o[.>]c;cat<<;#&&alert"(
printfn "Hello World!"//)

```

7 distance from 55

Try it here
> 4 votes

# Answer
## Answer 77 - Vimscript

```
"#sh  o[.]c;cat;#&&alert"  "
echo "Hello World!"
";#bye";dnl</vsh>~

```

Distance 7 from Answer 76
> 4 votes

# Answer
# Answer 80 - mIRC script

```
;?hh #[.]c;cat;#&&alert"  "
echo  Hello World!
;#";#bye;dnl</vsh>

```

Distance 7 from Answer 79: 1 comment marker (`;`), 6 removals (`$e=""~`).
> 4 votes

# Answer
# Answer 81 - Microsoft Batch

```
:?;#[.]c;cat;#&&alert"  "
@echo Hello World!
:;#";#bye;dnl</vsh>

```

Distance 7 from Answer 80: 3 additions, 4 cleanup.

Tested in Windows 7.
> 4 votes

# Answer
# Answer 90 - Oz

```
%#[]([.]c;main()
   {Show 'Hello World!'}
%#[;]:;#bye;dnl</>

```

Distance: 6 to answer 89
> 4 votes

# Answer
# Answer 108 - SmallBASIC

```
'--#[][.]#i--#main(){puts(
?"Hello World!
'--#[;]#bye;dnl</>"%

```

Distance 7 from Answer 107 (I could do it in 4, but I spent the rest on getting rid of unnecessary fluff like that annoying tab from the Makefile.)

Yes, SmallBASIC does not require closing strings.
> 4 votes

# Answer
# Answer 124 - Swift

```
//#{//-##[][/]#i--#main(){println(;\#//sel/.*}}
print("Hello World!")
//#;//"-##[;]#bye</>%

```

Distance 7 from answer 123.
> 4 votes

# Answer
# Answer 125 - BeanShell

```
//#{//-##[][/ void main(){println(;\#//sel/.*}}
print("Hello World!");
//#;//"-##[;]#bye</>%

```

Distance from Answer 124 : 7

> Trying to move towards Java
> 4 votes

# Answer
# Answer 129 - AWK

```
//#class{//-##[][ void main(){//println(;\#//sel/.*}}
END{print("Hello World!")}
//#;//"-##[;]#bye</>%

```

Distance from Answer 128 : 7

Run it online here
> 4 votes

# Answer
# Answer 157 - Improbable

```
#B00class jux{public static void main(String[] h){#
#System.Cont.Wrintln(//;\//Hello*}}print,cat<<<"#`Hello World!` ;}}//print#putsx;//-##[;]#bye</>%"

```

Distance from Answer 156 : 7

Everything

* in `# ... #` is a comment
* in `` ... `` is output to STDOUT
* after `;` is ignored as program has exited
> 4 votes

# Answer
# Answer 158 - wake

```
#B00class jux{public static void main(String[] h){#
#System.Cont.Wrintln(//;\//Hello*}}print,cat<<<
:"Hello World!"#` ;}}//print#putsx;//-##[;]#bye</>%"

```

Distance 5.
> 4 votes

# Answer
# Answer 164 - Alice

```
(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#

```

Distance 7 from Answer 163
> 4 votes

# Answer
# Answer 165 - SML/NJ

```
(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

Distance 2 from Answer 164

This could be any SML dialect, including Alice — but answer 164 isn't valid SML: only Alice allows an unterminated comment.

(MLton is now within reach.)
> 4 votes

# Answer
# Answer 166 - OCaml

```
(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print_string "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

Distance 7 from Answer 165
> 4 votes

# Answer
## Answer 171 - Fexl 7.0.3

Distance 7 from Answer 170.

```
#03w!(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
put
"Hello World!"#(O).g!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

I don't have enough reputation to comment on others' posts yet but I think that the other Answer 171 is invalid because it uses non-printable-ASCII chevrons (» and «).
> 4 votes

# Answer
# Answer 179, Fuzzy Octo Guacamole

```
#^.`4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
#put"

#^
is~ob"Hello World!"@)
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

Pretty standard.

Since `#` is a comment, most of the lines are skipped.

After removing the comments, you get this:

```
is~ob"Hello World!"@)
gx`

```

Everything after the `@` is not executed, since `@` is end.

```
is~ob"Hello World!"@

```

The important parts is the `"Hello World!"@` which pushes and prints (implicit output).

---

The rest:

`i` is invert, `s` is switch. This doesn't do anything important, moves `1` to the inactive stack (invert `0` and move).

`~ob` negates (bitwise) pushing `-1`, and sets the rest ToS (as a string) to `b`. This basically says `b` now pushes `-1` to the stack.
> 4 votes

# Answer
## Answer 41 - B.A.S.I.C.

```
#//;ah="*#[.>]trac":;cat<<@
#&&alert
? "Hello World!"

```

Distance 2 from 40

You can test it here

First 2 lines are just REMs and the question mark is interpreted as PRINT
> 3 votes

# Answer
# Answer 43 - fish shell

```
#ah="*#[.>]trac";cat<<
#&&alert
echo "Hello World!
"

```

**Levenshtein distance from #42**: 7 (2 removal, 3 substitutions, 2 additions)

I hope an extra newline is okay.
> 3 votes

# Answer
# Answer 45 - TCL

```
#ah="*#[.>]trac";cat<<
#&&alert
puts "Hello World!";#\

```

Distance 7 from #44
`;#\` is useless but I wanted to make the future answer more challenging.

http://ideone.com/P0PqMd
> 3 votes

# Answer
# Answer 58 - Burlesque

```
"//echo o[.>]c;cat<<;#&&alert" "Hello World!"/vsh

```

Distance 7 from answer 57.
> 3 votes

# Answer
## Answer 64 - Forth

```
\ %;dnl<vsh  o[.]c;cat;#&&alert" ">w "
.( Hello World!)\ bye";dnl</vsh>

```

Distance from Answer 63 : 7

Try it online here
> 3 votes

# Answer
## Answer 68 - Betterave

```
~#%# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in( print ~
$"Hello World!"~ #%!#bye";dnl</vsh>~

```

Distance from Answer 67 : 7
> 3 votes

# Answer
# Answer 89 - Matlab

```
%#[]([.]c;main()
    disp 'Hello World!'
%#[;]:;#bye;dnl</>

```

Distance: 7 to answer 88.
> 3 votes

# Answer
## Answer 91 - CASIO BASIC

```
'#[]([.]c;main()    {Show
"Hello World!"
'}%#[;]:;#bye;dnl</>

```

Distance from Answer 90 : 7
> 3 votes

# Answer
## Answer 92 - VBScript

```
'#[]([.]c;main()    {
MSgBox"Hello World!"
'}/#[;]:;#bye;dnl</>

```

Distance 7 from Answer 91
> 3 votes

# Answer
# Answer 98 - Kaffeine

```
//[]([.]#i
//main()    {
    alert('Hello World!');
//#[;]#bye;dnl</>

```

Distance: 7

Does it count if it's exactly JavaScript syntax, but technically a different language?
> 3 votes

# Answer
# Answer 99 - Algoid

```
//[][.]#i
//main()    {
    print("Hello World!");
//#[;]#bye;dnl</>

```

Distance 7 from Answer 98
> 3 votes

# Answer
# Answer 110 - SQLite

```
--#[][.]#i--#main(){puts(
select "Hello World!";
--#[;]#bye;dnl</>%

```

Distance 7 from Answer 109: modifed `ay` into `el`, added `ect` followed by a space, and `;`.
> 3 votes

# Answer
## Answer 113 - SQL (postgres)

```
--##[][.]#i--#main(){puts(
select'Hello World!' "
"--##[;]#bye;dnl</>%"

```

Distance 7 from 112

* remove "
* inserted carriage return before select
* substitute " with '
* remove carriage return," and space
* insert ' after !
> 3 votes

# Answer
# Answer 116 - Opal.rb

```
#a/-##[][/]#i--#main(){
puts(
#sel/.*
/Hello World!/)
#b/"-##[;]#bye;nl</>%"

```

Opal is a Ruby dialect compiled to Javascript. Opal's `stdout` points to the browser console.

Changes:

* line comment (3x)
* newline (2x)
* fix `puts`. Putsing regexes works surprisingly well...
* right parenthesis on L4.
> 3 votes

# Answer
# Answer 118 - Pawn

```
//-##[][/]#i--#
main(){
printf(
//sel/.*
"Hello World!")
}//"-##[;]#bye;nl</>%"

```

Distance from Answer 117 : 7

Try it here
> 3 votes

# Answer
## Answer 119 - Scala

```
//-##[][/]#i--#main(){
println(
//sel/.*
"Hello World!")
//"-##[;]#bye</>%"

```

Distance 7 from Answer 118: deleted newline, replaced `f`by `ln`, deleted `}` and `;nl`.

You can try it online here.
> 3 votes

# Answer
# Answer XXX - Commodore BASIC

Verdict by @CalvinsHobbies, OP:

> Sorry but as clever as this may be, PETSCII isn't ASCII. If this kind of shifting was allowed then arguably any 97 unique characters could be used. This is invalid.

...but for those who want the cleverness anyhow:

---

```
1dA//#{//-##[][/ void main(){println(;\#//sel/.*}}
2print("Hello World!");
3dA//#;//"-##[;]#bye</>%

```

Distance from Answer 125: 7

The "trick" comes from the fact that there are some little-known abbreviations in C64 BASIC. There's no abbreviation for REM, but it turned out `dA` for DATA served just as well...as long as you never try to read it!!

Technically speaking one has to bend the rules at least a little, as the Commodore 64 doesn't use ASCII...it uses PETSCII. Here is the "shifted" PETSCII equivalent. Thus a lowercase `a` is *actually* 0x41 (dec 65)...and an uppercase `A` maps to 0xC1 (dec 93) in the "shifted PETSCII" character set.

Next there are some characters with no exact equivalent. For instance, ASCII open brace `{` 0x7B (dec 123). The PETSCII standard would show that as a cross (✚). Yet if you write it directly into screen memory (as with `POKE 1024,123`) you get a box in the lower left, like Unicode's "quadrant lower left" character (▖). Unfortunately there are no PETSCII equivalents for the likes of `[` 0x5B (dec 91)...only screen memory codes.

Hence I've substituted the screen memory equivalents into source for the codes of the five characters that have no ordinary mapping:

* `{` (0x7B) =\> screen code 0x7B =\> quadrant lower left (solid) *CBM+F key*
* `}` (0x7D) =\> screen code 0x7D =\> quadrant upper left (hollow) *CBM+X key*
* `[` (0x5B) =\> screen code 0x5B =\> cross bar *no known key combo*
* `]` (0x5D) =\> screen code 0x5D =\> vertical line *SHIFT+minus key*
* `\` (0x5C) =\> screen code 0x5C =\> left half filled in block *CBM+J key*

Because I don't actually know how on the keyboard to get the cross bar other than POKE-ing into screen memory, that's what I did. I typed the program in with a dummy character at first in the three positions where open braces existed and then wrote some poke statements as shown. You could put any character there really, but I wanted the code to be as true to the ASCII values as possible.

Voila. Of course when you're done with the POKE statements you'll have to cursor back up and hit ENTER on the code lines again so the source changes will take.

Be sure to get into shifted PETSCII mode before you run it, with CBM-shift or `POKE 53272,23`. How the program is produced isn't that relevant, as it could be saved and loaded, but this just gets it all on one screen.
> 3 votes

# Answer
# Answer 126 - Vala

```
//#{//-##[][/
void main(){//println(;\#//sel/.*}}
print("Hello World!");
}//#;//"-##[;]#bye</>%

```

Distance from Answer 125 : 4
> 3 votes

# Answer
# Answer 127 - Pike

```
//#clas{//-##[][/
void main(){//println(;\#//sel/.*}}
write("Hello World!");
}//#;//"-##[;]#bye</>%

```

Tested here.

Distance 7 from answer 126.
> 3 votes

# Answer
# Answer 128 - Suneido

```
//#class{//-##[][/void main(){//println(;\#//sel/.*}}
Print("Hello World!")
//#;//"-##[;]#bye</>%

```

Distance 7 from answer 127: deleted newline, changed `w` into `P`, inserted `n`, deleted `e`, then `;` and `}`, and because I'm nice I used my last one to add the last `s` of `class`.

Never heard of Suneido before today but according to the language specs, `Print("...")` is the print statement and `//` the comment chars for single line comments.
> 3 votes

# Answer
# Answer 131 - AngelScript

```
//#class{//-ta[][
void main(){//println(;\#//Hello*}}

print("Hello World!");}
//#;//"-##[;]#bye</>%

```

Distance from Answer 130 : 7
> 3 votes

# Answer
# Answer 135 - BogusForth

```
"/#class jux{//-ta[][static void main(){//println(;\#//Hello*}}

print""Hello World!"i"#!puts
#;//-##[;]#bye</>%"

```

Distance 7 from answer 134. (5 necessary, 2 for `ic` in `static`)
> 3 votes

# Answer
# Answer 147 - Tiny

```
#class jux{//-ta][static void main(String[]){System.out.println(;\#//Hello*}}print,
"Hello World!"#;write"putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 146

1. remove ;
2. remove /
3. remove /
4. removed `\n` (newline) to have print on above line
5. added # after "Hello World" to comment out the rest of the trash.
6. u int out
7. t in out (hoping to see that java answer)

At this point I'm just looking through EVERY language in esolangs.org... haha
> 3 votes

# Answer
# Answer 154 - S+

```
#//#class jux{public static void main(String[] h){
#System.out.println(//;\#//Hello*}}print,
cat('Hello World!')#;}}//print#putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 153.
> 3 votes

# Answer
# Answer 155 - Hexish

```
0B00class jux{public static void main(String[] h){
#System.Cont.Wrintln(//;\#//Hello*}}print,
cat('Hello World!')#;}}//print#putsx;//-##[;]#bye</>%"

```

Distance 7 from 154

Im going for c# now!
> 3 votes

# Answer
# Answer 159 - brat

```
#B00class jux{public static void main(String[] h){#
#System.Console.Wrinteln(//;\//Hello*}}print,cat<<<
p "Hello World!"#` ;}}//print#putsx;//-##[;]#bye</>%"

```

Distance from Answer 158 \- 7

2 necessary and 5 for flowing towards C#
> 3 votes

# Answer
# Answer 160 - Busybox built-in shell

```
#class jux{public static void main(String[] h){#
#System.Console.Wrinteln(//;\//Hello*}}print,cat<<<
echo "Hello World!"#` ;}}//print#putsx;//-##[;]#bye</>%"

```

4 necessary changes, removed 3 characters to move towards C#.
> 3 votes

# Answer
# Answer 161 - Gammaplex

```
#class jux{public static void main(String[] h){#
#System.Console.Wrinteln(//@\//Hello*}}print,cat<<<
RrXoX"Hello World!"X` ;}}//print#putsx;//-##E;]#bye</>%"

```

Distance 7 from answer 160.

Despite the positions of `@` and `E`, they are necessary. Sorry for editing late. Rollback if you already started working on this.

Gammaplex is yet another 2D language. The official interpreter will ignore all new lines, then rearrange all characters into a rectangle with the same width of the first line. The above code is like this in Gammaplex:

```
#class jux{public static void main(String[] h){#
#System.Console.Wrinteln(//@\//Hello*}}print,cat
<<<RrXoX"Hello World!"X` ;}}//print#putsx;//-##E
;]#bye</>%"

```
> 3 votes

# Answer
# Answer 163 - ALGOL 68

```
#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#
print("Hello World!")#X` ;}}//printputsx;//-##E;]bye</>%#

```

Distance 7 from answer 162.
> 3 votes

# Answer
# Answer 173 - Vitsy

Distance 7 from answer 172

```
4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"
a
"Hello World!";#(O).g!)S(#X` ;}}//printputsx;//-##E;]bye</>#*)

```

Oh, geez, that was easier than I expected it to be.

Explanation:

`4mrZ` inserted (4 chars), which calls the 4th index of code (the 5th line), reverses the stack, and then outputs everything in the stack as a char. I can get away with no newline due to the `#` character, which will teleport to the 90th character in the first line (which doesn't exist) (`Z` in ASCII), throwing an error and exiting the program.

Newline inserted before `"Hello...` (one char) to designate a new method line.

`"` substituted for `'` at the end of `World!'` (one char) to end the quotes.

`;` inserted after the newly substituted `"` (one char), which is a return character. This leaves `Hello, World!` on the stack.

More interestingly, if you want to know what Vitsy is actually reading, here's the verbose mode version (any lines starting with `:` designate a newline):

```
push 4;
goto top method;
reverse stack;
output stack as chars;
toggle double quote;
teleport to top instruction;
push 0;
push 3;
wait top seconds;
if (int) top is 0;
multiply top two;
teleport to top instruction;
push 12;
push length of stack;
push 10;
push inverse sine of top;
push inverse sine of top;
 ;
j;
flatten top two stacks;
x;
!;
rotate stack left;
push whether (int) top item is prime;
flatten top two stacks;
push 11;
push length of stack;
push input item;
push 12;
 ;
push inverse sine of top;
push inverse tangent of top;
push 10;
push inverse tangent of top;
push input item;
push 12;
 ;
save top as temporary variable;
capture stack as object with next;
push input item;
push 13;
 ;
goto top method;
push 10;
push input item;
eval(stack);
if (int) top is 0;
push sine of top;
push inverse tangent of top;
reverse stack;
push input item;
eval(stack);
g;
begin recursive area;
end recursive area;
 ;
factorize top item;
if (int) top is not 0;
rotate stack left;
teleport to top instruction;
repeat next instruction set top times;
:teleport to top instruction;
push sine of top;
push number of stacks;
push inverse sine of top;
push inverse tangent of top;
push 14;
goto top method;
.;
push cosine of top;
capture stack as object with next;
eval(stack);
push inverse sine of top;
capture stack as object with next;
push length of stack;
push 14;
.;
STDIN;
reverse stack;
push input item;
push inverse tangent of top;
push 14;
push length of stack;
eval(stack);
if (int) top is 0;
divide top two;
divide top two;
get top specified item;
repeat next instruction set top times;
divide top two;
divide top two;
push all ints between second to top and top;
push 14;
push length of stack;
push length of stack;
capture stack as object with next;
multiply top two;
rotate stack right;
rotate stack right;
push whether (int) top item is prime;
reverse stack;
push input item;
eval(stack);
push inverse tangent of top;
,;
push 12;
push 10;
push inverse tangent of top;
go backward;
go backward;
teleport to top instruction;
multiply top two;
if (int) top is not 0;
repeat next instruction set top times;
:push whether (int) top item is prime;
flatten top two stacks;
push inverse tangent of top;
toggle double quote;
:push 10;
:toggle double quote;
push all ints between second to top and top;
push 14;
push length of stack;
push length of stack;
capture stack as object with next;
 ;
STDIN;
capture stack as object with next;
reverse stack;
push length of stack;
push 13;
!;
toggle double quote;
generic exit;
teleport to top instruction;
if (int) top is 0;
output top as character;
if (int) top is not 0;
.;
g;
!;
if (int) top is not 0;
push sine of top;
if (int) top is 0;
teleport to top instruction;
remove top;
`;
 ;
generic exit;
rotate stack right;
rotate stack right;
divide top two;
divide top two;
push whether (int) top item is prime;
reverse stack;
push input item;
eval(stack);
push inverse tangent of top;
push whether (int) top item is prime;
flatten top two stacks;
push inverse tangent of top;
push inverse sine of top;
x;
generic exit;
divide top two;
divide top two;
subtract top two;
teleport to top instruction;
teleport to top instruction;
push e;
generic exit;
end recursive area;
push 11;
push number of stacks;
push 14;
go backward;
divide top two;
go forward;
teleport to top instruction;
multiply top two;
if (int) top is not 0;
```

Try it Online!
> 3 votes

# Answer
# Answer 180, 05AB1E

```
i#^.`4mrZ"#03w(*#class jux!{public static void main(String[]ih){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
#put"

#^
is~ob]"Hello World!"q@)
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

Distance 4 from Answer 179. Try it online!

## Explanation

The program starts with an `i`f statement. Since the stack is empty, that makes all of `i#^.`4mrZ"#03w(*#class jux!{public static void main(String[` no-ops. When it gets to `]`, it closes all if statements, loops, etc. But, right ahead of that is another `i`f. Once again the stack is still empty, so all of

```
ih){#\
#System.Console.Writeln(//@\//Hello*}

```

is a huge no-op. Next, `p` checks if top of stack is prime. Yet again the stack is empty, so it's also a no-op. Same goes with `r`; it just reverses the (empty) stack. Then the program encounters `i` with an empty stack again, so

```
int,cat<<#*)\
#put"

#^
is~ob

```

is yet another no-op. Again, the `]` exits all if statements, loops, etc. Next 05AB1E parses "Hello World!" as a literal string and pushes it to the stack. Finally, `q` exits the program, making the rest of the code a no-op, and implicitly outputs top of stack.
> 3 votes

# Answer
# Answer 182 - Vyxal

```
kh\!#^.`4mrZ#03w(*#class jux!{public static void main(String[]ih){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
#put

#^
is~ob]"Hello World!"q@)
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

Try it Online!

Distance of 4 from the last answer.

Due to a parsing bug in the current version of Vyxal, everything after the `kh\!` is commented out, including the last two lines.
> 3 votes

# Answer
# Answer 46 -

```
#ah="*#[.>]trac";cat<<
#&&alert
println("Hello World!")#\

```

Distance 7.

I haven't actually run this. It may be that `#` comments must only have whitespace in front of them, in which case this is invalid, but I really doubt that.
> 2 votes

# Answer
# Answer 52 - tcsh

```
#//echo o[.>]tac;cat<<;#&&alert
(printf "Hello World!");

```

Distance 7 from answer 51.
> 2 votes

# Answer
## Answer 55 - Pixie; fallback option: ClojureCLR

```
"//echo o[.>]c;cat<<;#&&alert"(printf
"Hello World!")

```

Distance 3 from answer 54

The language is in early alpha and seem to have only REPL. Example session:

```
$ ./pixie-vm
Pixie 0.1 - Interactive REPL
(linux, gcc)
----------------------------
user => "//echo o[.>]c;cat<<;#&&alert"(printf
//echo o[.>]c;cat<<;#&&alert
user => "Hello World!")
12
Hello World!user =>
$

```

When run outside REPL, I expect it to output just "Hello World!", without additional things.

The language is inspired by Clojure. The script works in Clojure too (without messy additional REPL output)

Here is example of ClojureCLR session (used clojure-clr-1.3.0-Debug-3.5.zip):

```
$ mono Clojure.Main.exe hello.clj ; echo
Hello World!
$

```
> 2 votes

# Answer
# Answer 57 - Falcon

```
//echo o[.>]c;cat<<;#&&alert"(
> "Hello World!"//)

```

Distance: 7
> 2 votes

# Answer
## Answer 65 - Salmon

```
# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".(
"Hello World!"!#bye";dnl</vsh>

```

Distance 7 from Answer 64
> 2 votes

# Answer
## Answer 66 - Turing

```
%# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".(
put "Hello World!" %!#bye";dnl</vsh>

```

Distance: 7
> 2 votes

# Answer
# Answer 72 - AutoLISP

```
;<vsh  o[.]c;cat;#&&alert" ">w "
(princ "Hello World!");%!#bye";dnl</vsh>~

```

Distance of 7 from Answer 71 (3 deletions of random stuff).

P.S. For those who argue about invalidity of different dialects of Lisp, you should post on the first dialect..
> 2 votes

# Answer
## Answer 74 - Rebol

```
;<vsh  o[.]c;cat;#&&alert"  "
print "Hello World!";%!#bye";dnl</vsh>~

```

Distance from Answer 73 \- 7

Anything followed by `;` till newline is comment in Rebol
> 2 votes

# Answer
## Answer 75 - Maple

```
#sh  o[.]c;cat;#&&alert"  "print
"Hello World!";#bye";dnl</vsh>~

```

Distance 7 from Answer 74.
> 2 votes

# Answer
# Answer 78 - ksh

```
#sh  o[.]c;cat;#&&alert"  "
echo -en "Hello World!"
#";#bye;dnl</vsh>~

```

Distance 7 from Answer 77.
> 2 votes

# Answer
# Answer 94 - Processing

```
//[]([.]c;main()    {
print("Hello World!");
//#[;]#bye;dnl</>

```

Distance 7 from answer 93
> 2 votes

# Answer
# Answer 97 - Dart

```
//[]([.]#i
main()    {
    print('Hello World!');}
//#[;]#bye;dnl</>

```

Distance: 7

It's about time we got an `#include` of some sort.
> 2 votes

# Answer
# Answer 101 - Alore

```
--#[][.]#i
--#main()    {
    Print("Hello World!");
--#[;]#bye;dnl</>

```

Distance 7 from answer 100.
> 2 votes

# Answer
# Answer 103 - T-SQL

```
--#[][.]#i
--#main()    {
    Print('Hello World!');
--#[;]#bye;dnl</>"%

```

Distance 7 from Answer 102.
> 2 votes

# Answer
# Answer 104 - LiveCode

```
--#[][.]#i
--#main()    {
    put("Hello World!")
--#[;]#bye;dnl</>"%

```

should be run from the message box in multiline mode

Distance 7 from Answer 103.
> 2 votes

# Answer
# Answer 105 - Euphoria

```
--#[][.]#i
--#main()    {
puts(1,"Hello World!")
--#[;]#bye;dnl</>"%

```

Distance 4 from Answer 104
> 2 votes

# Answer
## Answer 106 - SpeakEasy

```
$ --#[][.]#i--#main()    {puts(1,
"Hello World!"
$ --#[;]#bye;dnl</>"%

```

Distance from Answer 105 : 7
> 2 votes

# Answer
# Answer 111 - TPP

```
--##[][.]#i--#main(){puts(select"
Hello World!
--##[;]#bye;dnl</>%

```

Distance 7 from Answer 110: moved `select "` to the line above and removed the space (2 deletion2), changed `--#` to `--##` on both lines (2), removed the `";` from the end of the second line (2), and changed the space between select and `"` to a newline (1). As my `sed` post was deleted, I am assuming that I can post without waiting 8 more hours. This doesn't *print* "Hello World!", but displays it instead. If this is an unsatisfactory answer, let me know.
> 2 votes

# Answer
# Answer 112 - Geom++

```
"--##[][.]#i--#main(){puts(select"
" Hello World! "
"--##[;]#bye;dnl</>%"

```

Distance 7 from Answer 111 (7 additions)

**Yes the spaces are required and no they're not printed**
> 2 votes

# Answer
# Answer 115 - RegXy

```
a/-##[][/]#i--#main(){pu/s(
sel/.*/Hello World!/
b/"-##[;]#bye;nl</>%"

```

Distance from Answer 114 : 7

RegXy is based on Regular Expressions, perl styled.

`label/regex/target_label` means if the `regex` matches, go to the `target_label` line

`label/regex/replacement/` means replace the `regex` match with `replacement` text.

Some more links
> 2 votes

# Answer
# Answer 122 - PARI/GP

```
\\#{//-##[][/]#i--#main(){println(
\\#//sel/.*}}
print("Hello World!")
\\#;//"-##[;]#bye</>%"

```

Distance 6 from Answer 121.

Tested using http://www.compileonline.com/execute\_pari\_online.php
> 2 votes

# Answer
# Answer 123 - Red

```
;\#{//-##[][/]#i--#main(){println(
;\#//sel/.*}}
print "Hello World!"
;\#;//"-##[;]#bye</>%

```

Distance from Answer 122 : 7
> 2 votes

# Answer
# Answer 130 - Neko

```
//#class{//-ta[][ void main(){//println(;\#//Hello*}}
END
{$print("Hello World!")}
//#;//"-##[;]#bye</>%

```

Distance 7 from answer 129.
> 2 votes

# Answer
# Answer 132 - gosu

```
//#class jux{//-ta[][ void main(){//println(;\#//Hello*}}

print("Hello World!");
//#;//"-##[;]#bye</>%

```

Distance 6 from Answer 131
> 2 votes

# Answer
# Answer 133 -

```
"/#class jux{//-ta[][ void main(){//println(;\#//Hello*}}

print""Hello World!"puts
#;//"-##[;]#bye</>%

```

Distance 7 from answer 132.
> 2 votes

# Answer
# Answer 134 – ALAGUF

```
"/#class jux{//-ta[][stat void main(){//println(;\#//Hello*}}

print"0"Hello World!"#!puts
#;//"-##[;]#bye</>%

```

Distance 7 from answer 133.

Moving towards Java...
> 2 votes

# Answer
# Answer 137 - Caché ObjectScript

```
 //#class jux{//-ta[][static void main(){y//println(;\#//Hello*}}
 write "Hello World!" ;!puts
#;//-##[;]#bye</>%"

```

Distance 7 from Answer 136.
> 2 votes

# Answer
# Answer 138 - owl

```
#//#class jux{//-ta[][static void main(Str){y//println(;\#//Hello*}} write
"Hello World!"#;!puts
#;//-##[;]#bye</>%"

```

Distance 7 from Answer 137 (4 necessary, 3 to add `int`).
> 2 votes

# Answer
# Answer 139 – Cardinal

```
x//#class jux{//-ta[][static void main(Str){Sys//println(;\#//Hello*}} write
%"Hello World!";x!puts
x;//-##[;]#bye</>%"

```

Distance 7 from answer 138 (5 necessary, 2 for adding `Sys`).
> 2 votes

# Answer
# Answer 140 - Parser

```
#//#class jux{//-ta[][static void main(Str){Syst//println(;\#//Hello*}} write
Hello World!
#x!putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 139 (6 nessasary, 1 for `Syst`).
> 2 votes

# Answer
# Answer 141 – Grin

```
[//#class jux{//-ta][static void main(Str){Syste//println(;\#//Hello*}} write]
(Hello World!)`x!putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 140 (6 necessary, 1 for `Syste`).
> 2 votes

# Answer
# Answer 142 - Kitten

```
//#class jux{//-ta][static void main(Str){Syste//println(;\#//Hello*}} write]
"Hello World!"say"putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 141.
> 2 votes

# Answer
# Answer 144 - Asymptote

```
//#class jux{//-ta][static void main(String[]){System..println(;\#//Hello*}}
write("Hello World!");//y"putsx;//-##[;]#bye</>%"

```

Distance 7 from Answer 143 \- 4 (-\>`\n`, `]`-\>`(`, and `);`) + 3 free changes (`Syste//`-\>`System..`))
> 2 votes

# Answer
# Answer 145 - Cat

```
//#class jux{//-ta][static void main(String[]){System..println(;\#//Hello*}}
"rite""Hello World!"write"putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 144.

Tested in the C# interpreter. It doesn't work in the online interpreter.
> 2 votes

# Answer
# Answer 146 - IDL

```
;//#class jux{//-ta][static void main(String[]){System.o.println(;\#//Hello*}}
print,"Hello World!";write"putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 145.

1. Inserted `;` before `/`
2. Replaced `"` by `p`
3. Replaced `t` by `n`
4. Replaced `e` by `t`
5. Inserted `;` before `w`
6. Inserted `,` after `print`

And:

7. Added `o` after `System.`
> 2 votes

# Answer
# Answer 148 - WTFZOMFG

```
#class jux{public[static void main(String[]){System.out.println(;\#//Hello*}}print,
'Hello World!"#;write"putsx;//-##[;]#bye</>%"

```

Distance from Answer 147 : 7

First language that I have seen which has unmatched quotes as syntax :D
> 2 votes

# Answer
# Answer 149 - Io

```
#class jux{public static void main(String[]){System.out.println(;\#//Hello*}}print,
"Hello World!"print"putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 148 (6 necessary, 1 for the space after `public`).

Io supports both `write("...")` and `"..."print`, but not `print("...")` or `"..."write` unfortunately.

This question has most answers in this site now.
> 2 votes

# Answer
# Answer 152 - Onyx

```
#/#class jux{public static void main(String[] h){System.out.println(//;\#//Hello*}}print,
`Hello World!'#);}}//
print#putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 151.

I found these languages here: http://concatenative.org.
> 2 votes

# Answer
# Answer 153 - JBoss

```
//#class jux{public static void main(String[] h){
System.out.println(//;\#//Hello*}}print,
'Hello World!');//}}//print#putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 152.

Note due to incorrect syntax the last line was changed... 2014-11-18 (OP)
> 2 votes

# Answer
# Answer 156 - yash

```
#B00class jux{public static void main(String[] h){
#System.Cont.Wrintln(//;\#//Hello*}}print,
cat<<<"Hello World!" #;}}//print#putsx;//-##[;]#bye</>%"

```

Distance 7 from answer 155 (5 necessary, 2 change the single quotes to double quotes, to make next answers easier).

I'll stop looking for new languages now. And I'll be no longer answering so fast. I'll only post answers with languages that I have found but yet didn't have chance to use.

I also found `apt-cache search` useful. And if you want more languages that only a few people use, you can try something like this. If you want it to be uninteresting, you can also see here.

There are also many esolangs and serious languages in those long lists not have been used yet, I think.
> 2 votes

# Answer
## Answer 170 - Minkolang 0.9

Distance 7 from answer 169.

```
03w!(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
pint)(!
"Hello World!"(O).g!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

The two additions are `03w` at the beginning, which jumps it to the beginning of the fourth line and `(O).` after `"Hello World!"`, which prints out the whole stack as characters. Very, very, very conveniently, this is exactly 7 characters!
> 2 votes

# Answer
# Answer 172 - Jolf

Distance 7 from answer 171.

```
"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"
a"Hello World!'#(O).g!)S(#X` ;}}//printputsx;//-##E;]bye</>#*)

```

Guide:

* Five insertions; `"`s at beginning and after `put`; `\` after first two lines; `a` before "Hello World!
* 1 substitution; `'` to `"` on the last line
* 1 deletion; the `%` towards the end.

Try it here!
> 2 votes

# Answer
# Answer 174 -

Distance 7 from answer 173. Try it here!

```
"4mrZ""#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"

^
"Hello World!"gx;#(O).g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)

```

Surrounded `4mrZ` with quotes (2); added two characters `gx` after "Hello, World!". Added a newline after `put"`, replaced the `a` with a `^`, removed the `x` from `printsputsx;//` on the last line. Both `4mrZ` and the long text after it are quoted and pushed to the stack; `^` probably does something, but nothing relevant, `"Hello World!"` pushes that sting to the stack, and `g` prints one item from the stack. `x` terminates the program. Fun fact: removing the `x` gives *infinite* "Hello World!"s because of the `X`, which wraps around to the beginning of the section.
> 2 votes

# Answer
# Answer 175 - Retina

```
x`4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"

^
Hello World!
gx`#(O).g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)
<empty>

```

Distance 7 from Answer 174.

The last line is simply an empty line, so the next person should remove `<empty>`. I used free-spacing mode so that `#` starts a comment. This takes care of the unmatched brackets and parentheses. I guess the `g` is the last replace's configuration string is ignored?

**Try it online**
> 2 votes

# Answer
## Answer 177 - Seriously

```
H.`4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"

^
disp"Hello World!")
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX
<empty>

```

The last line is intended to be empty; SE doesn't like blank lines at the end of code blocks.

Distance 6 from Answer 176

Modifications:

```
+ H. (at the start, prints "Hello, World!")
+ X  (before the first . on the last line; prevents extraneous printing by clearing the stack)
+ `kx  (at the end, finishes a function definition and clears the stack to prevent printing)

```
> 2 votes

# Answer
# Answer 76 - FreeBASIC

```
'#sh  o[.]c;cat;#&&alert"  "
print "Hello World!"
';#bye";dnl</vsh>~

```

Distance: 5
> 1 votes

# Answer
# Answer 79 - Hack

```
<?hh #[.]c;cat;#&&alert"  "
echo $e= "Hello World!"
;#";#bye;dnl</vsh>~

```

Distance 7 from answer 78.
> 1 votes

# Answer
# Answer 84 - sh

```
#[]([.]c;cat;#&&alert"  "
    echo Hello "World!"
#[;]:;#bye;dnl</vsh>

```

Distance from answer 83: 7

* Added `#`
* Removed `@`
* Changed `(` to
* Added 2 `"`'s
* Added `#`

Yes, `bash` and `dash` have been done, but I'm just taking the opportunity here as `sh` has not...

Added the quotes just to get some difficulty up.
> 1 votes

# Answer
# Answer 86 - csh

```
#[]([.]c;main()&al
    echo Hello World!
#[;]:;#bye;dnl</vsh>

```

Distance: 7
> 1 votes

# Answer
# Answer 93 - QBasic

```
'#[]([.]c;main()    {
print("Hello World!")
'}/#[;]:;#bye;dnl</>

```

Distance 7 from answer 92.

C is possible now.
> 1 votes

# Answer
# Answer 109 - REXX

```
--#[][.]#i--#main(){puts(
say"Hello World!"
--#[;]#bye;dnl</>%

```

Distance from Answer 108 : 7

Try it online here
> 1 votes

# Answer
# Answer 114 - itflabtijtslwi

```
/-##[][/]#i--#main(){puts(
select/Hello World!/
"-##[;]#bye;nl</>%"

```

Distance 7 from answer 113.

I saw so many Lisp, sh, Basic and SQL dialects here. This time it's a /// dialect.
> 1 votes

# Answer
# Answer 117 - Squirrel

```
#/-##[][/]#i--#main(){
print(
#sel/.*
"Hello World!")
#b/"-##[;]#bye;nl</>%"

```

Distance 7 from answer 116.
> 1 votes

# Answer
# Answer 136 - Flaming Thunder

```
#/#class jux{//-ta[][static void main(){//println(;\#//Hello*}}

write"Hello World!".#!puts
#;//-##[;]#bye</>%"

```

Distance from Answer 135 : 7
> 1 votes

# Answer
# Answer 143 - TwoDucks

```
//#class jux{//-ta][static void main(String[]){Syste//println(;\#//Hello*}} write]
"Hello World!"//y"putsx;//-##[;]#bye</>%"

```

Distance from Answer 142 \- 7 (2 for `//` 5 for `ing[]`)
> 1 votes

# Answer
# Answer 176 - Codename Dragon

```
x`4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"

^
disp"Hello World!")
gx`#(O).g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)
<empty>

```

Distance 7 from Answer 175.

For some reason, this works without the leading `(`. The seven chars added were `disp"` (5) followed by `")` (2). (NOTE THAT THE LAST LINE IS AN EMPTY LINE.)

To execute the program, go the github in the header and paste CDragon.js into a jsfiddle or something, then call the `wrapper` function with the above code.
> 1 votes

# Answer
# Answer 178 - Reng v.3.3

```
^.`4mrZ"#03w(*#class jux!{public static void main(String[] h){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
put"

^
<isp~;ob"Hello World!")
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

Distance 7 from Answer 177. Changes:

* `H``^` (1)
* `d``<` (2)
* inserting `~;ob` (6)
* removing the final newline (7)

Here is the code passed over:

```
^

<   ~;ob"Hello World!")
g

```

`g` and `)` are no-ops. Otherwise, this is a pretty standard HW submission. Try it here!
> 1 votes

# Answer
# Answer 183 - Jyxal 0.5.1

```
kh\!+#^.`4mrZ#03w(*#class jux!{public static void main(String[]ih){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
#put
#is~ob]"Hello World!"q@)
#gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

No, Jyxal is not Vyxal. Distance of 5.
> 1 votes

# Answer
# Answer 169 - Simplex v.0.6

```
!(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
pint)(!
"Hello World!"g!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

```

Distance 7 from answer 168:

* 3 `!` inserted
* 1 newline inserted
* 2 `"` inserted
* 1 `g` inserted

Hopefully the newline helps a bit. Anything of the form `!...!` not in a string is treated as a comment, and a matching `!` is not required, as an EOF closes everything/does not care if something is closed. I'll extract the portion of the code I used to make it more clear:

```
!...!\n"Hello World!"g!...
!...!                      ~~ comment
     \n                    ~~ newline
       "            "      ~~ consecutively add each character to the strip
        Hello World!       ~~ add this
                     g     ~~ clear the strip and output those characters
                      !... ~~ comment the rest of the file

```
> 0 votes

# Answer
# Answer 181, Foo

```
i#^.`4mrZ#03w(*#class jux!{public static void main(String[]ih){#\
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)\
#put

#^
is~ob]"Hello World!"q@)
gx`#(O)X.g!)S(#X` ;}}//printputs;//-##E;]bye</>#*)`kX

```

Distance of 2 from the last answer

Foo simply prints everything between quotes.

Try it online!
> 0 votes

---
Tags: printable-ascii, hello-world, answer-chaining
---


title: Removed J-brackets

text:
# Question
Title: Removed J-brackets
For a 2 dimensional array we will call the elements in either the first row or the last column the "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:

\\$ \begin{bmatrix} \color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4} & \color{red}{\underline 8} \\ 9 & 3 & 6 & \color{red}{\underline 7} \\ 3 & 3 & 2 & \color{red}{\underline 9} \end{bmatrix} \\$

The J-bracket is given in order starting from the first element of the first row and going clockwise. The element that is in both the row and the column is not repeated. So for the above that is:

\\$ \left\[1, 2, 4, 8, 7, 9\right\] \\$

Your task is to take as input a 2 dimensional array of positive integers, and repeatedly remove J-brackets from it until the remaining array has no more elements. Your output should be all the J-brackets removed in this process in the order they were removed.

The input will always be perfectly rectangular, and both dimensions will be at least 1. You may take input in any reasonable format.

This is so the goal is to minimize the size of your source code as measured in bytes.

## Test cases

```
[[2]] -> [[2]]
[[1,2],[3,4]] -> [[1,2,4],[3]]
[[1,2,4,8],[9,3,6,7],[3,3,2,9]] -> [[1,2,4,8,7,9],[9,3,6,2],[3,3]]
[[1,2],[3,4],[5,6]] -> [[1,2,4,6], [3,5]]
[[1,2],[3,4],[5,6],[7,9]] -> [[1,2,4,6,9], [3,5,7]]

```

# Answer
# Haskell, ~~(53)~~ 47 bytes

*Fixed and golfed 6 bytes thanks to Wheat Wizard*

```
f((a:b):c)=(a:b++(last<$>c)):f(init<$>c)
f x=[]

```

Try it online!
> 5 votes

# Answer
# , 37 bytes

```
\(m)split(m,pmin(row(m),rev(col(m))))
```

Attempt This Online!

Working on the related challenge led me to this approach. Test harness taken from pajonk's answer.

In an \\$m\times n\\$ matrix \\$A\\$, each element \\$A\_{ij}\\$ is in the \\$p^\text{th}\\$ J-bracket if and only if \\$\min(i,n+1-j)=p\\$.

R has some odd built-ins that return the matrix \\$R=\text{row}(M)\\$ where \\$R\_{ij}=i\\$ and similarly for \\$C=\text{col}(M)\\$. Reversing the column matrix luckily performs the right operation, and we take the `p`arallel `min`imum of these matrices to obtain a matrix of J-brackets, which `split` helpfully breaks into groups of the right order.
> 5 votes

# Answer
# BQN, 11 bytesSBCS

```
⌊⌜⟜⌽○↕´∘≢⊸⊔

```

Run online!

```
          ⊔  # Group the values by:
        ≢    # The shape of the matrix
      ´      # Reduce the shape by:
    ○↕       # Convert both integers to a range [0, n)
  ⟜⌽         # Reverse the right range
⌊⌜           # Minimum table

```
> 4 votes

# Answer
# , ~~117~~ ~~88~~ ~~86~~ ~~76~~ 72 bytes

*Edit: **-~~29~~ 31 bytes** thanks to @Giuseppe; -10 bytes thanks to Robin Ryder; another -4 bytes thanks to @Giuseppe.*

```
f=\(M)"if"(1%in%dim(t(M)),M,list(c(M[1,],M[-1,n<-ncol(M)]),f(M[-1,-n])))
```

Attempt This Online!

Recursive approach with some clever tricks by @Giuseppe and Robin Ryder.
> 4 votes

# Answer
# Python 2, 52 bytes

```
a=input()
while[[]]<a:print a.pop(0)+map(list.pop,a)
```

Attempt This Online!

-4 bytes thanks to @ovs
> 3 votes

# Answer
# Jelly, 10 bytes

ßest Friends Forever?!

```
Ḣ;Ṫ€W;ßFF?

```

A monadic Link that accepts a rectangular list of lists and yields a list of lists.

**Try it online!** Or see the test-suite.

### How?

```
Ḣ;Ṫ€W;ßFF? - Link: list of lists, X
Ḣ          - head -> top row of X (mutates X)
   €       - for each of (the remaining rows of) X:
  Ṫ        -   tail -> last element of the row (mutates X)
 ;         - concatenate these together
    W      - wrap that list in a list -> Z
         ? - if...
        F  - ...condition: flatten (the mutated) X (falsey once empty or only empty rows)
      ß    - ...then: call this Link with (the mutated) X
       F   - ...else: flatten (the mutated) X -> an empty list
     ;     - Z concatenate that

```
> 3 votes

# Answer
# K (ngn/k), 44 bytes

```
{,'/(&/d)#'(-1 1*!'d:#'1*:\x)_''1(1_'|+:)\x}

```

Try it online!

Solved in my worst attempt at find-the-j-twin. It seems a shame to let it go to waste...
> 3 votes

# Answer
# Vyxal, 14 bytes

```
λ[ḣƛt;J,ḢƛṪ;x¤

```

Try it Online!

## Explanation

```
λ[ḣƛt;J,ḢƛṪ;x¤
λ                 Open a lambda (for recursion)
 [                If statement (check if truthy)
  ḣ               Separate the first item, push both sides to stack
   ƛt;            Map to last item of each
      J           Join both lists
       ,          Pop and print (the J bracket)
        Ḣ         All but the first item
         ƛṪ;      Map to all but the last item of each
            x     Recurse
             ¤    Empty space (so that it won't output an empty list at the end, since stack is implicitly output)

```
> 3 votes

# Answer
# Python, 49 bytes

```
f=lambda a,i=0:a and[*a.pop(i),*f([*zip(*a)],~i)]
```

Attempt This Online!

Loosely based on @pxeger's Python 2 answer.
> 2 votes

# Answer
# PARI/GP, 51 bytes

```
f(m)=m&&print(concat(m[1,],m[^1,#m]~))*f(m[^1,^#m])
```

Attempt This Online!
> 1 votes

# Answer
# APL+WIN, 47 bytes

Prompts for 2 dimensional matrix

```
m←⎕⋄⍎∊(⌊/⍴m)⍴⊂'m[1;],1↓,m[;1↓⍴m]⋄m←1 0↓0 ¯1↓m⋄'

```

Try it online! Thanks to Dyalog APL Classic
> 1 votes

# Answer
# 05AB1E, 15 bytes

```
[ćs©€θ«,®€¨Wg_#

```

Try it online or verify all test cases.

**Explanation:**

```
[          # Loop indefinitely:
 ć         #  Extract head; pop and push first row and remainder-matrix
  s        #  Swap so the remainder-matrix is at the top
   ©       #  Store it in variable `®` (without popping)
    €θ     #  Pop and only leave the last value of each row
      «    #  Merge it to the extracted first row
       ,   #  Pop and output this list with trailing newline
   ®       #  Push matrix `®` again
    €¨     #  Remove the last integer from each row
      W    #  Push the flattened minimum of the matrix (without popping)
       g   #  Pop and push the length of it
        _  #  If this length is 0:
         # #   Stop the infinite list

```
> 1 votes

# Answer
# Java 8, 109 bytes

```
m->{for(int i=0,j;;){var t=m[j=i++];for(;++j<m.length;)t.add(m[j].pop());if(t.size()>0)System.out.print(t);}}

```

Input as an array of Integer-Stacks; output prints directly to STDOUT.

Try it online.
> 1 votes

# Answer
# Charcoal, 20 bytes

```
≔⮌ＡθＷ›θＥθυＩ⟦⁺⊟θＥ⮌θ⊟κ

```

Try it online! Link is to verbose version of code. Explanation: Port of @pxeger's Python solution.

```
≔⮌Ａθ

```

Reverse the input as Charcoal can only pop from the end of a list.

```
Ｗ›θＥθυ

```

Repeat until the input has no rows or columns.

```
Ｉ⟦⁺⊟θＥ⮌θ⊟κ

```

Remove the now last row and the last column of the remaining rows reversed back into their original order and output those values.
> 1 votes

# Answer
# Factor, 69 bytes

```
[ [ 1 cut flip 1 short cut* rot prepend concat . flip ] until-empty ]

```

Try it online!

## Explanation

It's a quotation (anonymous function) that takes a matrix as input and prints its J-brackets, one per line.

* `[ ... ] until-empty` Repeatedly call a quotation on an input until it is empty.

```
         ! { { 1 2 4 8 } { 9 3 6 7 } { 3 3 2 9 } }
1 cut    ! { { 1 2 4 8 } } { { 9 3 6 7 } { 3 3 2 9 } }
flip     ! { { 1 2 4 8 } } { { 9 3 } { 3 3 } { 6 2 } { 7 9 } }
1 short  ! { { 1 2 4 8 } } { { 9 3 } { 3 3 } { 6 2 } { 7 9 } } 1
cut*     ! { { 1 2 4 8 } } { { 9 3 } { 3 3 } { 6 2 } } { { 7 9 } }
rot      ! { { 9 3 } { 3 3 } { 6 2 } } { { 7 9 } } { { 1 2 4 8 } }
prepend  ! { { 9 3 } { 3 3 } { 6 2 } } { { 1 2 4 8 } { 7 9 } }
concat   ! { { 9 3 } { 3 3 } { 6 2 } } { 1 2 4 8 7 9 }
.        ! { { 9 3 } { 3 3 } { 6 2 } }
flip     ! { { 9 3 6 } { 3 3 2 } }

```
> 1 votes

# Answer
# Ruby, 46 bytes

```
f=->m{[m.shift+m.map(&:pop),*m*"">""?f[m]:[]]}

```

Try it online!

Takes advantage of *shift* and *pop* which modifies object in place and return what we needed.

Checking the updated *m* was a bit difficult because pop and shift may return *nil* which is *truthy* in Ruby
> 1 votes

# Answer
# Wolfram Language (Mathematica), 91 bytes

```
(l=Length@#&@@#;Flatten@Pick[#,MapIndexed[Min[#,l-#2+1]&@@#2&,#,{2}],i]~Table~{i,Tr[1^#]})&

```

Try it online!

Feels too long but I couldn't find anything shorter
> 1 votes

# Answer
# JavaScript (ES6),  ~~66 63~~  59 bytes

*Saved 4 bytes thank to @l4m2 (on both versions)*

Returns a list.

```
f=m=>[[...m.shift(),...m.map(r=>r.pop())],...m>'0'?f(m):[]]

```

Try it online!

### Commented

```
f =                // f is a recursive function taking
m =>               // a matrix m[]
[                  //
  [ ...m.shift(),  // extract the first row and split it
    ...m.map(r =>  // for each row r[] in m[]:
      r.pop()      //   extract the last element of r[]
    )              // end of map()
  ],               //
  ...m > '0' ?     // if there's still at least one number in m[]:
    f(m)           //   append the result of a recursive call
  :                // else:
    []             //   stop the recursion
]                  //

```

---

# JavaScript (V8),  ~~65 62~~  58 bytes

Prints the results.

```
f=m=>print([[m.shift()],...m].map(r=>r.pop()))|m>'0'&&f(m)

```

Try it online!
> 0 votes

# Answer
## PHP 5.4 (93 chars)

The function **j** take a *$m* PHP array and return the answer as a PHP array.

```
function j($m){for(;$k=array_shift($m);$j[]=$k)foreach($m as&$z)$k[]=array_pop($z);return$j;}

```

Variant using **105 characters** :

The function **j** take a *$m* matrix and print the answer as JavaScript Object Notation array.

```
function j($m){for(;$k=array_shift($m);$j[]=$k)foreach($m as&$z)$k[]=array_pop($z);echo json_encode($j);}

```

Try it online
> 0 votes

---
Tags: code-golf, array
---


title: Repeat average

text:
# Question
Title: Repeat average
## Background

It was a normal presentation that I were in as a audience, until the presenter gave a math problem about repeat taking 2 number out of a list a replacing them with average, claiming that there will be something special about it, and our math teacher, sitting at the end of classroom, exciting rushed to me, and tasked me to code that out.

## Task

2 input `length` and `generation`

1. Generate a range, start from 0, with length of `length`
2. Randomly choose 2 number (or item) `X` and `Y` and replace both `X` and `Y` with the average of `X` and `Y`
3. Repeat step 2 for `generation` times
4. Output minimum, maximum, average, and the processed list.

## Example

I'll let this semi-golfed python code explain itself :)

```
import random
a,b=map(int,input().split())
l=[*range(a)]
s=lambda:random.randint(0,a-1)
for i in range(b):
    x,y=s(),s();l[x],l[y]=[(l[x]+l[y])/2]*2
print(min(l),max(l),sum(l)/a,l)

```

## Rules

* Standard rules applies
* Input can be in any convenience form.
* As long as you output is clean, understandable, readable, it is allowed.
* The two random value `X`,`Y` should be *uniform statistically independent* random by itself(`X` and `Y` are not affecting each other no matter what)

## what you should do?

* Start golfing right now!

# Answer
# Jelly, 25 bytes

```
ḶJX,XƊṬ×ịÆm¥oʋƊ⁹¡µṂ;Ṁ;Æm,

```

Try it online!

Outputs `[[min, max, mean], list]`. Takes `length` as the first argument, and `generation` as the second

## How it works

```
ḶJX,XƊṬ×ịÆm¥oʋƊ⁹¡µṂ;Ṁ;Æm, - Main link. Takes L on the left, G on the right
Ḷ                         - [0, 1, ..., L-1]
              Ɗ           - Previous 3 links as a monad f(R):
 J                        -   Indices of R
     Ɗ                    -   To the indices of R:
  X                       -     Randomly choose one
    X                     -     Randomly choose one again
   ,                      -     Pair; [i, j]
             ʋ            -   Last 4 links as a dyad g([i, j], R):
      Ṭ                   -     Boolean array with 1s at i and j
           ¥              -     Last 2 links as a dyad h([i, j], R):
        ị                 -       Get R[i] and R[j]
         Æm               -       Take the mean
       ×                  -     Replace the 1s with the mean
            o             -     Or; replace the elements at i and j in R with the mean
               ⁹¡         - Apply f(R) G times
                 µ        - Use this list L' as the new argument
                  Ṃ       - Minimum
                    Ṁ     - Maximum
                      Æm  - Mean
                   ; ;    - [Min, Max, Mean]
                        , - Pair with L'

```
> 3 votes

# Answer
# APL+WIN, 60 bytes

Prompts for length and generation. Index origin = 0

```
v←⍳l←⎕⋄⍎∊⎕⍴⊂'v[i]←(+/v[i←(?l),?l])÷2⋄'⋄(⌊/v),(⌈/v),(+/v÷l),v

```

Try it online!Thanks to Dyalog Classic

The results in TIO are output in the order listed in the question. The second example in TIO shows that by generation=1000 all elements of the output have converged to the mean in that particular case.
> 3 votes

# Answer
# Vyxal, 25 bytes

```
ʁ?(₅‹₍℅℅~İṁ£(n¥Ȧ)):₌₍GgṁW

```

Try it Online!

25 bytes of fun. Takes `length` then `generations` and outputs `[list, [Max, Min], average]`. Can be 24 bytes with the `W` flag

## Explained

```
ʁ?(₅‹₍℅℅~İṁ£(n¥Ȧ)):₌₍GgṁW
ʁ                          # The range [0, length) - this will be the list we modify
 ?(                        # (generation) times:
   ₅‹                      #   push the top of the stack, and its length + 1
     ₍℅℅                   #   choose two random items from the range [0, length) and place them into a list
        ~İ                 #   without popping anything, get the item at each randomly chosen index from the top list - this leaves [list, indexes, items] on the stack
          ṁ£               #   place the average of those two items into the register
            (...)          #   for each index i in the indexes list:
             n¥Ȧ           #      list[i] = register (the mean)
                 )         # close the main for loop
                  :        # now the top of the stack is the list with all the replaced items. We duplicate it so we can extract the juicy info from it
                   ₌₍Ggṁ   # Push a list of [max, min] and push the mean of that list
                        W  # Wrap everything into a single list and implicitly print

```
> 2 votes

# Answer
# JavaScript (ES6), 145 bytes

Expects `(length)(generation)`. Returns `[min, max, avg, list]`.

```
with(Math)f=(n,a=[k=n],R=random)=>g=m=>k?g(m,a[--k]=k):m?g(m-1,a[i=R()*n|0]=a[j=R()*n|0]=(a[i]+a[j])/2):[min(...a),max(...a),eval(a.join`+`)/n,a]

```

Try it online!
> 2 votes

# Answer
# Python, 134 bytes

```
from random import*
R=randrange
def f(l,g):*a,=range(l);exec("a[x]=a[y]=a[x:=R(l)]/2+a[y:=R(l)]/2;"*g);return min(a),max(a),sum(a)/l,a
```

Attempt This Online!

-13 bytes thanks to pxeger using `randrange` and `:=`
> 2 votes

# Answer
# Charcoal, 39 bytes

```
ＦＮ⊞υιＦＥＮＥ²‽ＬυＵＭυ⎇№ιλ⊘ΣＥι§υμκＩ⟦⌊υ⌈υ⊘⊖Ｌυυ

```

Try it online! Link is to verbose version of code. Explanation:

```
ＦＮ⊞υι

```

Generate a range of length `length`.

```
ＦＥＮＥ²‽Ｌυ

```

Generate `generation` pairs of random integers also in that range, and loop over those pairs.

```
ＵＭυ⎇№ιλ⊘ΣＥι§υμκ

```

Update the array at those two indices with the average of the two values that are there.

```
Ｉ⟦⌊υ⌈υ⊘⊖Ｌυυ

```

Output the minimum, maximum, average and values.
> 2 votes

# Answer
# Python3, ~~133~~ ~~131~~ 128 bytes

```
from random import*
def f(l,g):
 *r,=range(l)
 while g:shuffle(r);*r,x,y=r;r+=[(x+y)/2]*2;g-=1
 return min(r),max(r),sum(r)/l,r

```

Try this online
> 2 votes

# Answer
# , 44 bytes

```
(<./;>./;];+/%#)@(2&((?#)(2%~1#.{)`[`]}])i.)

```

Try it online!

Outputs Min / Max / List / Avg
> 2 votes

# Answer
# Factor, 87 bytes

```
[ iota >array [ randomize 2 cut* mean dup 2array append ] repeat dup minmax pick mean ]

```

Try it online!
> 2 votes

# Answer
# BQN (CBQN), 56 bytes

```
{A←+´÷≠,(⌈´∾⌊´∾A∾⋈){∾˜∘A⌾((2•rand.Range≠)⊸⊏)}⍟↕}
```

Attempt This Online!

fixed after ovs' comment.

-1 from ovs.
> 2 votes

# Answer
# Julia, 81 bytes

```
l\g=(L=[0.:~-l;];1:g.|>_->(r=rand(1:l,2);L[r].=sum(L[r])/2);(extrema(L),~-l/2,L))

```

Try it online!

expects `length\generation` and returns `((min, max), mean, list)`
> 1 votes

# Answer
# TI-Basic, 85 bytes

```
Prompt L,G
seq(I,I,0,L-1→A
For(I,1,G
rand(dim(ʟA→B
SortA(ʟB,ʟA
mean({ʟA(1),ʟA(2→ʟA(1
Ans→ʟA(2
End
Disp min(ʟA),max(ʟA),mean(ʟA),ʟA

```

<sup>`seq(I,I,` can be replaced with `randIntNoRep(` for -3 bytes if the calculator supports it.</sup>

Output is displayed.
> 1 votes

---
Tags: code-golf, random, statistics
---


title: How many Sieve of Eratosthenes hits?

text:
# Question
Title: How many Sieve of Eratosthenes hits?
Sieve of Eratosthenes is a method for finding prime numbers:
take the sequence of all positive integer numbers starting from 2 then for each remaining number drop all its multiples.

```
2 3 x 5 x 7 x 9 x 11 x 13 x 15 x 17 x ...
2 3 _ 5 _ 7 _ x _ 11 _ 13 _  x _ 17 x ...

```

**Task**

Given a number \\$n \ge 2\\$, find the minimum amount of numbers you have to drop before you can determine whether *n* is a prime number or not using the Sieve of Eratosthenes.

For example if you want to check if \\$15\\$ is prime you start dropping multiples of \\$2\\$:
`2 3 x 5 x 7 x 9 x 11 x 13 x 15 ..`
then \\$3\\$:
`2 3 _ 5 _ 7 _ x _ 11 _ 13 _ X ..`

Here we are! 15 was dropped so it's not prime.
We dropped 8 numbers.

Note that we don't need to check more numbers.
That is, you don't have to find how many *not-primes* are there.

Note also that if the number you are testing is prime then you have to try all numbers up to it( without considering optimizations) , and you have to drop all not primes actually in that case.

**Test cases**

Terms for *n* from 2 to 100

```
0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 8, 7, 9, 8, 10, 9, 12, 10, 13, 11, 15, 12, 16, 13, 18, 14, 19, 15, 20, 16, 23, 17, 24, 18, 24, 19, 27, 20, 28, 21, 28, 22, 31, 23, 33, 24, 32, 25, 36, 26, 37, 27, 36, 28, 41, 29, 42, 30, 40, 31, 45, 32, 47, 33, 44, 34, 50, 35, 51, 36, 48, 37, 55, 38, 56, 39, 52, 40, 59, 41, 59, 42, 56, 43, 64, 44, 66, 45, 60, 46, 67, 47, 71, 48, 64, 49

```

**Rules**

This is , the aim is to have the shortest code(in bytes) possible within the respect of golfing rules.

This is also so as usual you can output:

* *n-th* term.
* First *n* terms.
* The infinite sequence.

Where *n* refers to the actual number you have to check so the sequence starts at \\$n = 2\\$.

You can include 0 and 1, however those are considered undefined behaviour so the result doesn't matter.

Sandbox

# Answer
# Ruby, ~~40 68 ...~~ 60 bytes

```
->n,*w{4.step(n,2){|x|w[-1]==n||w|=[*x.step(n,x/2)]};w.size}

```

Try it online!

Reverse sieve: start with an empty set, add all multiples of numbers in the range (2..n) unless n is in the set. The result is the size of the final set.
> 8 votes

# Answer
# 05AB1E, 19 bytes

```
ÅP©÷L€¦®*˜ÙIpigëIk>

```

Outputs the \\$n^{th}\\$ term.

Try it online or verify the first 23 test cases or see this for a step-by-step outout.

**Explanation:**

```
ÅP        # Get all prime numbers up to and including the (implicit) input
  ©       # Store this in variable `®` (without popping)
   ÷      # Integer-divide the (implicit) input by each of these primes
    L     # Transform each value into a [1,v] ranged list
     €¦   # Remove the leading 1 from each to make the range [2,v]
       ®* # Multiply each list by its prime from variable `®`
          # (we now have a list of lists of prime-multiples up to the input)
˜         # Flatten this list of lists
 Ù        # Uniquify it
  Ipi     # If the input itself is a prime:
     g    #  Pop the list and push its length
    ë     # Else:
     Ik>  #  Push the input's 1-based index instead
          # (after which the result is output implicitly)

```
> 5 votes

# Answer
# Python 3, 99 bytes

Pretty straightforward implementation of the sieve which stops updating values as soon as `n` has been marked as composite.

```
def f(n):
 r=[0]*-~n
 for p in range(2,n):r[p*p::p]=[v>=r[p]|r[n]for v in r[p*p::p]]
 return sum(r)

```

Try it online!
> 3 votes

# Answer
# Retina 0.8.2, 53 bytes

```
.+
$*,

$.`$*
^..

+1`(?=.*1$)(,(1+),.*?,)\2+\b
$1#
#

```

Try it online! Link is to test suite that outputs all the values from `2` to `n`. Explanation:

```
.+
$*,

$.`$*
^..

```

List all the values from `2` to `n` in unary with leading commas.

```
1`(?=.*1$)(,(1+),.*?,)\2+\b
$1#

```

Unless `n` has been replaced with a `#`, replace the smallest composite number divisible by the smallest possible prime with a `#`.

```
+`

```

Repeat until either `n` or all the composite numbers have been replaced with a `#`.

```
#

```

Output the number of integers that were replaced with a `#`.
> 3 votes

# Answer
# Jelly, 13 bytes

```
ḊÆfḢ$ÞẒÐḟ⁸0¦i

```

A monadic Link that accepts an integer, `n`, and yields an integer.

**Try it online!**

### How?

```
ḊÆfḢ$ÞẒÐḟ⁸0¦i - Link: n
Ḋ             - dequeue n -> [2,3,4,...,n]
     Þ        - sort by:
    $         -   last two links as a monad:
 Æf           -     prime decomposition e.g. 63 -> [3,3,7]
   Ḣ          -     head -> minimum prime factor    ^
       Ðḟ     - filter discard those for which:
      Ẓ       -   is prime?
           ¦  - sparse application...
          0   - ...to indices: zero (rightmost)
         ⁸    - ...apply: chain's left argument, n
                ...(this makes the rightmost entry, if there is one, become n)
            i - first 1-indexed index of n (zero if n is not found)

```
> 3 votes

# Answer
# C (gcc), 94 bytes

```
c;j;i;*s;f(n){s=calloc(n,4);for(c=j=i=1;++i<n&j!=n;)for(s[j=i]=1;j<n;j+=i)c+=!s[j]++;c-=j!=n;}

```

Try it online!

Inputs an integer \\$n\ge 2\\$.
Returns the \\$n^{\text{th}}\\$ term.
> 2 votes

# Answer
# JavaScript (ES6),  ~~67 61~~  55 bytes

*Saved 6 bytes thanks to @tsh*

```
n=>(g=j=>!g[j]*(j>i)+(n-j&&g(g[j]=j+i>n?++i:j+i)))(i=2)

```

Try it online!

### Commented

```
n => (            // n = input
  g =             // g is a recursive function taking:
  j =>            //   j = current number being tested
  !g[j] *         // increment the final result if g[j] is not set
  (j > i) + (     // and j is greater than i (i.e. when testing
                  // multiples of i, we don't count i itself)
    n - j &&      // unless j is equal to n,
    g(            // do a recursive call:
      g[j] =      //   mark j as dropped
      j + i > n ? //   if j + i is beyond n:
        ++i       //     increment i and restart
      :           //   else:
        j + i     //     keep going with j + i
    )             // end of recursive call
  )               //
)(i = 2)          // initial call to g with i = j = 2

```
> 2 votes

# Answer
# Python, 95 bytes

```
f=lambda n:(g:=lambda x:(g([i for i in x if i%min(x)])if n in x else n-len(x))-1)(range(2,n+1))
```

Attempt This Online!
> 2 votes

# Answer
# K (ngn/k), ~~38~~ 34 bytes

-4 bytes by adapting @Kevin Cruijssen's 05AB1E answer

```
{(#r)^(0,r:?,/(x<)_'n*/:n:2+!x)?x}

```

Try it online!

Outputs the *n-th* term (referred to within the code as `x`).

* `(...)?x` find the 0-based index of `x` in the list generated by `(...)` (returning `0N`, the integer null, if `x` is not present)
* `(...)`
    + `n:2+!x` generate the sequence `2..n+1`, storing in `n`
    + `n*/:n` calculate a multiplication table of these values
    + `(x<)_'` drop values larger than `x` from each row
    + `r:?,/` flatten, then uniquify the remaining values, storing in `r`
    + `0,` prepend a 0 (guaranteed to not already be present) to end up returning 1-based indices
* `(#r)^` replace nulls (i.e. prime `x`s) with the count of the list (i.e. the number of non-prime numbers smaller than `x`)
> 2 votes

# Answer
# Python, 76 bytes

```
f=lambda n,*s,t=2:len({*s})if n in[*s,t]else f(n,*s,*range(t+t,n+1,t),t=t+1)
```

Attempt This Online!
> 2 votes

# Answer
# Haskell, 69 bytes

```
f n=n-n![2..n]
n!(h:t)|n`elem`t=1+n![x|x<-t,x`mod`h>0]|1>0=2+length t

```

Try it online!
> 2 votes

# Answer
# Charcoal, 34 bytes

```
Ｎθ≔…·²θη≔ＬηζＷ№ηθ«≔Φη﹪κ⌊ηη≦⊖ζ»Ｉ⁻ζＬη

```

Try it online! Link is to verbose version of code. Explanation:

```
Ｎθ

```

Input `n`.

```
≔…·²θη

```

Start with the list of integers from `2` to `n`.

```
≔Ｌηζ

```

Store its length as we need to adjust for each prime we remove.

```
Ｗ№ηθ«

```

Repeat while `n` is found in the list.

```
≔Φη﹪κ⌊ηη

```

Remove all multiplies of the lowest prime remaining in the list from the list.

```
≦⊕ζ

```

Since this also removes the prime, don't count it as one of the integers that was dropped.

```
»Ｉ⁻ζＬη

```

Output the number of integers that were dropped.
> 1 votes

---
Tags: code-golf, sequence, primes
---