text:
Gasket Weaving - draw a Sierpiński knot
Given an integer N >= 2, produce an image showing a Sierpiński knot of degree N.
For example, here are knots of degree 2, 3, 4 and 5:

Click on the images to view full size (the higher the degree the larger the image).
Specification

A Sierpiński knot of degree N is drawn using the vertices of a Sierpiński triangle of degree N as guide points. A Sierpiński triangle of degree N is three Sierpiński triangles of degree N-1 arranged into a larger triangle. A Sierpiński triangle of degree 0 is an equilateral triangle.
The smallest component triangles have side length 64, giving the Sierpiński triangle on which the knot is based an overall side length of
The centre of the outer triangle is positioned at the centre of the image. This does not give equal white space at top and bottom.
The output is a square image of side length  where  is ceiling(x), the smallest integer greater than or equal to x. This is just large enough for the top vertex of the underlying Sierpiński triangle to be contained within the image when the centre of the triangle is at the centre of the image.
The single curve must pass over and under itself, strictly alternating. Solutions can choose between under then over, or over then under.
The example images show black foreground and white background. You may choose any two easily distinguished colours. Anti-aliasing is permitted but not necessary.
There must not be gaps where two arcs meet or where the curve passes over or under itself.
Output may be to any raster format image file, or to any vector format image file that includes a correct default display size. If you display directly to screen, this must be in a form that allows scrolling to see the full image when larger than the screen.

Determining arc centre, radius and thickness

The knot is constructed as a series of circular arcs that meet at points where their tangents are parallel, to give a seamless join. These arcs are displayed as annular sectors (arcs with thickness).
The centres of these arcs are the vertices of the smallest upside down triangles. Each such vertex is the centre of exactly one arc.
Each arc has a radius of
The exception is that the arcs in the three outermost triangles (at the corners of the large triangle) have a centre which is the midpoint of the two adjacent inner vertices, and thus have a radius of
Each arc is represented with a total thickness (difference between inner radius and outer radius) of  and the black borders of this each have a thickness of  The curve must have these borders, and not just be a solid strip.

Units of measure

All distances are in pixels (1 is the horizontal or vertical distance between 2 adjacent pixels).
The square root of 3 must be accurate to 7 significant figures. That is, your calculations must be equivalent to using a ROOT3 such that 1.7320505 <= ROOT3 < 1.7320515

Scoring
The shortest code in bytes wins.

For those wondering, N=0 and N=1 are not included because they correspond to a circle and a trefoil, which don't quite match the pattern that applies for N>=2. I would expect that most approaches to this challenge would need to add special case code for 0 and 1, so I decided to omit them.

Would it help to have a diagram to show what all the numbers relate to?

Before I golf my answer / add corners, are 7 significant figures really necessary for small details like the thickness of the line, etc? An accuracy like "7 significant figures or 1 pixel, whichever is larger" seems more appropriate.

@LevelRiverSt since the size of the image scales with the input, even 7 significant figures is insufficient for 1 pixel accuracy for larger N. I've settled on 7 significant figures after some discussion in chat, so that all answers are held to the same standard.

Yes it is necessary for the scaling of the picture for larger N. 7 significant figures on a 1000000 x 1000000 image corresponds to 0.1 pixels, but with intermediate calculations it could be worse than that. I just think stroke-width:3.464102 and similar is a bit excessive if the idea was to get 1 pixel accuracy. I will go ahead and include it like that, though, if that is the ruling.

Ruby, 1168 932
Corrected a mistake from last night, more golfing to do after clarifying.
This is (currently) a full program that accepts a number from stdin and outputs an svg file to stdout. I chose svg because I knew it was possible to meet all the requirements of the question, but it did have some issues. in particular SVG only supports arcs of circles as part of the path object, and does not define them in terms of their centre but rather the two endpoints.
Code
n=gets.to_i
r=64*w=0.75**0.5
m=1<<n-2
z=128*m/w
a=(s="<path style='fill:none;stroke:black;stroke-width:3.464102' transform='translate(%f %f)'
")%[0,r-r*m*8/3]+"d='M18.11943,-2A#{b=r-6*w-32} #{b} 0 0,0 #{-b} 0#{k='A%f %f 0 0 '%([58*w]*2)}0 0,38.71692
M28.58980,1.968882#{l='A%f %f 0 0 '%([70*w]*2)}0 #{c=r+6*w-32} 0A#{c} #{c} 0 0,0 #{-c} 0#{l}0 -9 44.65423'/>"
p=2
m.times{|i|(i*2+1).times{|j|(p>>j)%8%3==2&&a<<s%[128*(j-i),r*3+r*i*4-r*m*8/3]+
"d='M-55,44.65423#{k}0 11.5,25.11473#{l}1 35.41020,1.968882
M-64,51.48786#{l}0 20.5,30.31089#{k}1 36.82830,13.17993
M-82.17170,-2.408529#{l}1 -11.5,25.11473#{k}0 0,38.71692
M-81.52984 8.35435#{k}1 -20.5,30.31089#{l}0 -9,44.65423
M9,44.65423#{k}0 81.52984,8.35435
M0,51.48786#{l}0 91.17169,13.17993'/>"}
p^=p*4}
puts "<svg xmlns='http://www.w3.org/2000/svg' viewBox='#{-z} #{-z} #{e=2*z+1} #{e}' width='#{e}px' height='#{e}px'>"+
"<g transform='rotate(%d)'>#{a}</g>"*3%[0,120,240]+"</svg>"

Output N=4
rescaled by Stack exchange. Looks much better as original.

Explanation
At first I considered something like http://euler.nmt.edu/~jstarret/sierpinski.html where the triangle is broken down into three differently coloured strands, each of which forms a path from one corner to another. The incomplete circles are shown as incomplete hexagons there. inscribing circles inside the hexagons shows that the circle radius should be sqrt(3)/2 times the sidelength. The strands could be built up recursively as shown, but there is an added complication because the corners need to be rounded and it is difficult to know in which direction to curve, so I did not use this approach.
What I did was the following.
In the image below you can see there are horizontal twists belonging to the N=2 units (in green) arranged in a sierpinski triangle and additional bridging twists (in blue.)
It is common knowledge that the odd numbers on Pascal's triangle form a sierpinski triangle. A sierpinski triangle of binary digits can be obtained in an analogous manner by starting with the number p=1 and iteratively xoring it with p<<1.
I modified this approach, starting at p=2 and iteratively xoring with p*4. This gives a sierpinski triangle alternating with columns of zeros.
Now we can rightshift p and inspect the last three bits using %8. If they are 010 we need to draw a green twist belonging to an N=2 unit. if they are 101 we need to draw a blue, bridging twist. To test for both of these numbers together we find the modulo %3 and if this is 2 we need to draw the twist.
Finally, in additional to the horizontal twists, we make two copies rotated through 120 and 240 degrees to draw the diagonal twists and complete the picture. All that remains is to add the corners.
Commented code
n=gets.to_i

#r=vertical distance between rows
r=64*w=0.75**0.5

#m=number of rows of horizontal twists
m=1<<n-2

#z=half the size of the viewport
z=128*m/w

#s=SVG common to all paths
s="<path style='fill:none;stroke:black;stroke-width:3.464102' transform='translate(%f %f)'
"

#initialize a with SVG to draw top corner loop. Set k and l to the SVG common to all arcs of 58*w and 70*w radius
a=s%[0,r-r*m*8/3]+
"d='M18.11943,-2A#{b=r-6*w-32} #{b} 0 0,0 #{-b} 0#{k='A%f %f 0 0 '%([58*w]*2)}0 0,38.71692
M28.58980,1.968882#{l='A%f %f 0 0 '%([70*w]*2)}0 #{c=r+6*w-32} 0A#{c} #{c} 0 0,0 #{-c} 0#{l}0 -9 44.65423'/>"

#p is the pattern variable, top row of twists has one twist so set to binary 00000010
p=2

#loop vertically and horizontally
m.times{|i|
 (i*2+1).times{|j|

   #leftshift p. if 3 digits inspected are 010 or 101
   (p>>j)%8%3==2&&

   #append to a, the common parts of a path...
   a<<s%[128*(j-i),r*3+r*i*4-r*m*8/3]+

   #...and the SVG for the front strand and left and right parts of the back strand (each strand has 2 borders)
"d='M-55,44.65423#{k}0 11.5,25.11473#{l}1 35.41020,1.968882
M-64,51.48786#{l}0 20.5,30.31089#{k}1 36.82830,13.17993
M-82.17170,-2.408529#{l}1 -11.5,25.11473#{k}0 0,38.71692
M-81.52984 8.35435#{k}1 -20.5,30.31089#{l}0 -9,44.65423
M9,44.65423#{k}0 81.52984,8.35435
M0,51.48786#{l}0 91.17169,13.17993'/>"}

#modify the pattern by xoring with 4 times itself for the next row
p^=p*4}

#output complete SVG of correct size with three copies of the finished pattern rotated through 0,120,240 degrees.
puts "<svg xmlns='http://www.w3.org/2000/svg' viewBox='#{-z} #{-z} #{e=2*z+1} #{e}' width='#{e}px' height='#{e}px'>"+
"<g transform='rotate(%d)'>#{a}</g>"*3%[0,120,240]+"</svg>"

Where you say "Looks much better as original" it might be worth adding something like "(click the image to see full size)" for anyone who doesn't realise.

@trichoplax it hadn't occured to me to click on the image. But anyway, this is a PNG, because stack exchange does not accept svg images, so the edges are deliberately blurred. My local SVG file has much crisper edges and looks much better.

@trichoplax quick fix on image size done. Will golf more another day.

For anyone wondering, I am happy to accept z+1 as a golfed version of ceiling(z) because the argument is irrational and so can never be integer.

+1 great work. I particularly like the detailed explanation with the colour coded diagram.

@trichoplax before I continue with the golfing, I have a couple of questions. 1. Is a function returning the SVG code as a string OK?

@trichoplax 2. As line thickness is finite, is it OK to make curves slightly longer/shorter than theoretically required, provided this doesn't affect the final image? Example:(I've done this only once) 18.11943,-2 (start of inner curve for corner) has y coordinate rounded to nearest integer and x coordinate adjusted accordingly to be on correct circle arc. The fact that the line is slightly too long only becomes apparent at thickness around 0.3. With specified thickness of  3.464102 the end is completely covered by another line so I think this is OK? I'll use this technique more if confirmed.

Provided the technique will also hold for larger N, it's acceptable for the underlying arcs to overlap provided it makes the same final image. That is, provided the white part of the arc does not show up over the black part of an arc it should be behind, and the black part of the arc does not show up over the white part of an arc it should be behind. Parts of the same colour can overlap as the final image is the same.

I've only just realised I only answered your second question, and not your first. Sorry about that. I'm going to go with the default rule on graphical output, which seems to include your chosen output method and specifically mentions stdout too.

The hyperlink is dead.

Regarding "this is a PNG, becaquse stack exchange does not accept svg images"... yes, kind of annoying; however, I was able to make a working code snippet that shows an svg, in my answer to another question .  Maybe worth a try here?


text:
Is the electric garage door open?
My electric garage door works like this:

There is just one push button to control the door
If the door is fully closed and I hit the button, the door starts to open.  It takes 10 seconds to open fully
If the door is fully open and I hit the button, the door starts to close.  It takes 10 seconds to close fully
If the door is part way through opening or closing and I hit the button, then the door stops and is left partially open.
Whenever the door stops moving, either from automatic completion of an open or close action, or from manual interruption by pushing the button partway through an action, then the mechanism will reverse and remember its direction for the next action.
If the button is pushed when the door is stopped but partially open, then the amount of time for it to complete its action will be a fraction of 10 seconds in proportion to the amount it needs to move to complete the action.

Assume the door is fully closed at the start.
An input list of integers will be given.  These integers are the number of seconds I wait between successive pushes of the control button.
Output two things:

a percentage indicating the state of the door once all button pushes are completed and the door has reached a steady state.  Output of % symbol is optional.
an unambiguous indication of what direction the door will travel on the next button push.  This may be up/down, U/D, +/-, 1/0 or whatever you choose.

You may assume the door takes infinitesimally less than 10 seconds to complete an open or close action.
Example inputs:
<empty list>  # button was pushed just once
20            # button was pushed twice with 20 seconds between
10
5
20 20
10 10
5 5
1 2 3
8 9 10 11
11 10 9 8 7

Expected outputs corresponding to above inputs
100% D
0% U
0% U
50% D
100% D
100% D
0% U
100% D
0% U
20% U

Worked example of the last test

Door starts off closed.  Button is pushed
Wait 11 seconds.  Door ends up fully opened.  Button is pushed.
Wait 10 seconds.  Door ends up fully closed.  Button is pushed.
Wait 9 seconds.  Button is pushed.  Door stops at 90% open.
Wait 8 seconds.  Button is pushed.  Door starts to close.
Wait 7 seconds.  Button is pushed.  Door stops at 20% open.  Next direction will be up.

You garage door stops at half-open, if you press the button, while closing? Mine doesn't, only for opening.

@Bálint both way for mine.

@Maltysen lets stick with percentage now.

Is it okay if a floating point number is output if the input also consists of floating point number(s)?

@R.Kap yes, that's fine.

the door stops and is left partially open optimist or pessimist?

Lua, 258 248 242 bytes
u,s,p=1>0,0>1,0;io.read():gsub("%d+",function(a)if(not s)then p=u and p+a or p-a;if(p>=10 or p<=0)then s,p=1>0,p>0 and 10 or 0;end;u,s=not u,not s else s=0>1;end end)if(not s)then p=u and 10 or 0;u=not u;end;print(10*p.."% "..(u and"U"or"D"))

Ungolfed
u,s,p=true,false,0;                          -- Up direction, Stopped, Position
io.read():gsub("%d+",function(t)             -- For each number in input
    if(not s)then                            -- If door wasn't stopped
        p=u and p+t or p-t;                  -- Position = Moving up ? +t : -t
        if(p>=10 or p<=0)then                -- If door fully opened or closed
            s,p=true,p>0 and 10 or 0;        -- Then door stopped at 0 or 10
        end
        u,s=not u,not s;                     -- Toggle direction and toggle stopped
    else
        s=false;                             -- If stopped, nothing happened, un-stop.
    end
end)
-------------------- Done pressing the button --------------------
if(not s)then                                -- If left off moving
    p=u and 10 or 0;                         -- Finish movement
    u=not u;                                 -- Toggle direction
end
print(10*p.."% "..(u and"U"or"D"))           -- Output answer

I don't see how your test cases can be right...
20 20 -- Initial push, after 20, garage is at 100, push to start it down, after 20, garage is at 0, push to start it up, garage finishes up.
10 10 -- Same as above
1 2 3 -- 0 U Moving, wait 1, 1 D Stopped, wait 2, 0 U stopped, wait 3, 100 D stopped

 OP Fixed

I've just finished my entry and I agree with your results too.

JavaScript (ES6), 109 106 bytes
a=>a.map(e=>(s^=1)?(r-=e*(d=-d))>9?(s=0,r=10):r<1?(r=s=0):r:r,r=s=0,d=1)&&(s?r:5*++d)*10+(d-s?"% D":"% U")

@DigitalTrauma Must have been an optimisation error. I've reoptimised it and somehow managed to save 3 further bytes this time!

Pyth, 50 45 39 bytes
6 bytes thanks to Sp3000.
J1,*Tu@S[0T+?|!%GTZ+=Z0*H~_J~Z1G)1+QT0J

Test suite.

Ruby, 152 bytes
->v{u,s,a=!!1,!0,0;v.map{|w|!s ?(a=u ? a+w : a-w;a>=10 ?(s,a=!!1,10):a<=0 ?(s,a=!!1,0):0;u,s=!u,!s):s=!0};!s ?(a=(u=!u)?0:10):0;p"#{10*a}% #{u ??U:?D}"}

Test cases:
f=->v{u,s,a=!!1,!0,0;v.map{|w|!s ?(a=u ? a+w : a-w;a>=10 ?(s,a=!!1,10):a<=0 ?(s,a=!!1,0):0;u,s=!u,!s):s=!0};!s ?(a=(u=!u)?0:10):0;p"#{10*a}% #{u ??U:?D}"}

f[[]]            # => "100% D"
f[[20]]          # => "0% U"
f[[10]]          # => "0% U"
f[[5]]           # => "50% D"
f[[20,20]]       # => "100% D"
f[[10,10]]       # => "100% D"
f[[5,5]]         # => "0% U"
f[[1,2,3]]       # => "100% D"
f[[8,9,10,11]]   # => "0% U"
f[[11,10,9,8,7]] # => "20% U"

As a fun side note, you can remove the requirement for extra brackets at the cost of one byte, by changing ->v{ to ->*v{ (I think). Also, do you need the spaces before the : as well as after? And are you sure that the :a<=0 doesn't parse to (:a) <= 0?

Nice tip! Would need to be weighed up with access to the var though.  As for :a<=0, I'd get an ArgumentError: comparison of Symbol with 0 failed if it didn't work.  I think because it parsed the ? and knows it's in a ternary operator, it just works.  The rules are indeed strange.  I've put spaces or brackets in places that are needed to avoid syntax errors like SyntaxError: unexpected tLABEL and NoMethodError: undefined method u?'`.

Feel free to do an edit if you can see any improvements.  I was hoping to be able to get rid of a=u ? a+w : a-w and change it to a=a+w*d where d is 1 or -1 depending on direction, but I haven't worked it out yet.

From what I understand, editing to make code better is generally discouraged; instead, you should comment. As for your idea for improvement, I dunno; it seems like it could work, but I dunno for sure.

Python 3.5, 193 187 185 181 175 173 172 bytes:
def G(*p):
 O=100;y=0;l=10;z,v='UG'
 for g in[*p,O]:
  if v=='G':Q=O*g//10;y=min(max(0,[Q,y-Q][z=='D']),O);l=min(10,g);z='UD'[z=='U']
  v='GS'[(O>y>0)*(v!='S')]
 print(y,z)

Takes input in the form of comma separated numbers, for instance 1,2,3,4,5 or even 1.2,3.4,7.8,9.2. Outputs whether the door in the next step is going up or down with U or D, respectively. Will golf more over time.
Try It Online! (Ideone) (Here the input is taken in the form of a list consisting of comma separated numbers, e.g. [1,2,3,4,5].)

PHP, 128 120 bytes
$d=$argv[]=10;
foreach($argv as$a)
  if($r){$p=min(max($p+$a*$d,0),100);$r=$p<1||99<$p;$d=-$d;}else$r=1;
echo"$p% ".DU[$d>0];

The code is wrapped here to fit in the code box. Put everything on a single line, put the PHP open marker in front of it and save it into a file. Or run it from the command line using php -d error_reporting=0 -r '...the code...' [arguments].
The ungolfed source code, the test suite and examples of usage can be found on github.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Continuously expanding code
Your job is to write a program that rewrites and makes itself longer on each run of the program.
Challenge
The program will print Hello, World!\n (\n denotes a newline). Then, it will modify its own file so that the new program length is exactly 2x the length at runtime. This modified file when run, will print Hello, World!\nHello, World!\n. When run a third time, the file will print Hello, World!\nHello, World!\nHello, World!\nHello, World!\n.
More simply, on the nth run of the program, it will output 2^(n-1) instances of Hello, World!\n, and have a program length of 2^(n-1) the length of the original.
This is code-golf, so shortest code (before first run) wins. Please comment if you need something is not clear.
Edit: To get past the restriction of file-rewriting, your program may print the modified source along with the Hello, World!\ns at a +40% penalty.

"it will modify its own file" can you provide a way to circumvent this?

What do you mean by circumvent?

Well, we can't exactly modify our own file in online compilers...

@KennyLau How about printing something that theoretically would work offline?

Please don't create arbitrary tags... A discussion for this tag has already happened here (but this discussion was about a subset of KOTH challenges so might not be completely relevant here) and it was decided NOT to add [tag:self-rewriting] as a new tag, partially due to it being to narrow

@LegionMammal978 it's more like http://codegolf.stackexchange.com/q/69504/8478 I guess.

@LegionMammal978 Isn't that challenge about printing itself? This one isn't exactly that.

How is this an exact duplicate?

@ericw31415 Answers could be copied without much modification.

@LegionMammal978 Really? None of those involve [tag:self-rewriting] though. Also, the output increases exponentially.

@ericw31415 It's the difference between print("Hello, world!");print(quine(),quine()); and print("Hello, world!");write(this_file(),quine(),quine());

@LegionMammal978 Using, that though, on the 10th run, there will be 10 Hello, World!s, not 1024.

@ericw31415 write(this_file(),quine(),quine()); duplicates the program; I'm assuming here that it doesn't append.

PHP, 100
More efficient, 101
<?$a=$argv[0];$b=file_get_contents($a);file_put_contents($a,$b.substr($b,81,20));echo"Hello World\n";

This script is appending an echo"Hello World";, but because you said the size should also vary, and because it's shorter, I'm also having this script:
Shorter, 100
<?$a=$argv[0];$b=file_get_contents($a);file_put_contents($a,$b.substr($b,2,98));echo"Hello World\n";

This script is appending itself, in a way it adds one Hello World, but this version will overall take more space and takes longer to execute.
Example
But the scripts don't vary when it comes to the output:
root@raspberrypi:~/stack# php hello_expand.php
Hello World
root@raspberrypi:~/stack# php hello_expand.php
Hello World
Hello World
root@raspberrypi:~/stack# php hello_expand.php
Hello World
Hello World
Hello World

Umm, the third run of the program should have 4 Hello, Worlds!, not 3.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Print the AdamN tile
Adam7 is an interlacing algorithm for raster images, such as PNG. It is called the "Adam7" algorithm because it was invented by Adam M. Costello, and it is generated by following a certain pattern 7 times. One of the cool things about the Adam7 algorithm that makes it really fun for code golf, is that the pattern can be repeated an arbitrary number of times, as long as it's odd. Back when 1996 when the PNG standard was developed, using only 7 iterations was seen as sufficient, since the 9 iterations was too complex, and 5 iterations is not as efficient.
Here is the first iteration of the tile:
a

Pretty simple. This is an "Adam1" tile. Here's how we get to the next iteration, the "Adam3" tile.
Since our last tile was 1x1, we double the height and width, and the next one will be 2x2. First, we start with an 'a' in the upper left corner.
a-
--

Step 2, copy this pattern to the right, and increase the letter we're on by one.
ab
--

Step 3, same as step 2, but copy down instead of right.
ab
cc

Boom. The "Adam3" tile. Let's do the "Adam5" also, so you can actually see how the algorithm works. This tile will, again, be twice as large, so 4x4. Again, we start with a a in the upper left corner:
a---
----
----
----

Double this pattern, increase the letter, and move it to the right:
a-b-
----
----
----

Again, this time down.
a-b-
----
c-c-
----

Again, this time to the right.
adbd
----
cdcd
----

Again, this time down.
adbd
eeee
cdcd
eeee

This is the "Adam5" tile. Here is the ASCII representation of the Adam7 tile:
afdfbfdf
gggggggg
efefefef
gggggggg
cfdfcfdf
gggggggg
efefefef
gggggggg

And while we're at it, here is a fun animation of each step of the Adam7 tile (although it does several tiles side by side):

The challenge
Given a positive odd number N, output the "AdamN" tile. You can use any default method of IO. Since we're using the alphabet in lieu of numbers, you only need to handle inputs up to 25. You can choose to output lower-case or upper-case characters as long as you specify and it's consistent.
Sample IO
1:
a

3:
ab
cc

5:
adbd
eeee
cdcd
eeee

7:
afdfbfdf
gggggggg
efefefef
gggggggg
cfdfcfdf
gggggggg
efefefef
gggggggg

9:
ahfhdhfhbhfhdhfh
iiiiiiiiiiiiiiii
ghghghghghghghgh
iiiiiiiiiiiiiiii
ehfhehfhehfhehfh
iiiiiiiiiiiiiiii
ghghghghghghghgh
iiiiiiiiiiiiiiii
chfhdhfhchfhdhfh
iiiiiiiiiiiiiiii
ghghghghghghghgh
iiiiiiiiiiiiiiii
ehfhehfhehfhehfh
iiiiiiiiiiiiiiii
ghghghghghghghgh
iiiiiiiiiiiiiiii

As usual, this is code-golf, so standard loopholes apply, and shortest answer in bytes wins!

Where's the c in the testcase for 9?

@KennyLau Sorry, It's fixed now.

CJam, 20 bytes
Laq~{'a+_@f*\f+z}/N*

Try it online.
La                      Push [[]]
  q~                    Push input n
    {           }/      For i in 0..n-1 ...
     'a+                  Add to char 'a to give current char
        _@f*              Join each row by char
            \f+           Add char to the end of each row as well
               z          Zip to transpose
                  N*    Join result by newlines

20/21-byte alternatives:
Laaq~{'a+aff+:sz}/N*
Laaq~{'a+\Laf+f*z}/N*
Laq~{'a+f{_@*\+}z}/N*

MATL, 23 bytes
97tiq:+"TFX*tXa~@wZ(!]c

Try it online!
This uses repeated Kronecker tensor product for extending the array, followed by transposition. At each iteration, new columns containing zeros are interleaved with the old; those zeros are then replaced by the appropriate new value (which increases at each iteration); and the matrix is transposed.
(One byte wasted because Octave's Kronecker product doesn't allow char input. This will be fixed for next release).
EXplanation
97       % Push 97 (ASCII for 'a')
t        % Duplicate
iq:      % Take input n. Range [1 2 ... n-1]
+        % Add. Gives [98 99 ... 97+n-1] (letters to be filled)
"        % For each
  TFX*   %   Kronecker product with [1 0]. This interleaves new columns with zeros
  tXa~   %   Duplicate. Logical index for the new columns
  @wZ(   %   Assign letter to those columns
  !      %   Transpose (zip)
]        % End if
c        % Convert to chat. Implicitly display

Perl, 110 104 100 99 91 89 87 + 1 (-p flag) = 88 bytes
#!perl -p
$==$_/2;$_=a.$/;$"=b;s/\w/$&.$"/ge,$"++,s/\n/$&.$"x2**$%.$&/ge,$"++until$=<++$%;$\=$_}{

Using:
> echo 5 | perl -pe '$==$_/2;$_=a.$/;$"=b;s/\w/$&.$"/ge,$"++,s/\n/$&.$"x2**$%.$&/ge,$"++until$=<++$%;$\=$_}{'

Ungolfed:
while (<>) {
# code above added by -p
    # $_ has input value
    # $/ = "\n" by default
    # $% = 0 by default
    my $n = $_ / 2;   # input
    my $s = "a" . $/; # "a\n"
    my $c = "b";      # "b"
    my $i = $%;       # 0
    while (++$i <= $n) {
        $s =~ s/(\w)/$1 . $c/ge;
        $c++;
        $s =~ s/(\n)/$1 . ($с x 2**$i) . $1/ge;
        $c++;
    }
    $\ = $s;
} {
# code below added by -p
    print;  # prints $_ (undef here) and $\
}

Ideone.

Goodness.... what does such a long flag mean?

@CᴏɴᴏʀO'Bʀɪᴇɴ The -l flag assigns $\  variable to have the value with octal code 0141 (ASCII character a). And l141 is shorter than $\="a";.

Oh, how interesting!

JavaScript (ES6), 114 bytes
f=n=>n<2?`a
`:f(n-2).replace(/./g,`$&`+(n+8).toString(36)).replace(/\n/g,`
${(n+9).toString(36).repeat(1<<n/2)}
`)

oo, recursive. Nice!

Pyth, 38 bytes
u:+r:jK@;tyHGb++b*^2H@;yHb6b+bKbh/Q2"a

Try it here!
I would expect this to be easily golfable.


text:
Make the longest cat program
There's been challenges for the shortest cat program, but as far as I know, there hasn't been any for the longest one.
A cat program is a program that copies its input to its output. Here's an example:
Input: Hello
Output: Hello

Input: cat
Output: cat

So, the rules are simple:

The program has to copy its input to its output
No loopholes allowed.
This is code-bowling, so the longest code wins.

Also, I'm quite new here, so if you don't like this challenge, then please do tell me why so I'll be able to make better ones later!

The problem with [tag:code-bowling] challenges in general is that a simple "longest code wins" is usually not that useful. People can always throw in arbitrary things to make the code as long as they want, or use languages like Unary for obscene byte counts.

@Sp3000 Should I add a new rule against "arbitrary things"? Not sure how that's going to work out though.

You can try, but you'd have to have a good definition of what's not allowed. For example, "no comments" wouldn't work because someone could just do a += 1; a -= 1, which you can try to patch with "no no-ops" but then someone would just make the code count to a massive number, one increment at a time, and only execute the cat program at the end if the counter's at the right number. (Long story short: I don't think this challenge will work well, unfortunately...)

@m654 I suggest first using the sandbox before posting challenges.

@flawr Oh, I didn't know there was one :P Thanks for the info!

Brachylog, theoretically infinite
.............................................................................................

You can add as many periods as you like.
The first period will unify the output with the input. The second period will unify the output with the output (which is always true), the third period will unify the output with the output, etc.

Lenguage, 23855 bytes
Program: Any file that is 23855 bytes long
Based off the brainfuck cat program on an interpreter returns 0 on EOF:
,[.,]


text:
How many squares are there?
This challenge is inspired by a picture that often roams on Facebook that looks like this. Except our base square will look more like this:
┌─┬───┬─┐
├─┼─┬─┼─┤
├─┼─┴─┼─┤
├─┼─┬─┼─┤
└─┴─┴─┴─┘

The square is made out of n x m 1x1 square, you have to count how many sub-squares (1x1, 2x2, 3x3, 4x4, 5x5, etc.) can fit within that square. Squares can be missing some grid lines (like in the example above) or be complete like in the example bellow. Which means a mathematical breakdown is not possible (as far as I know).
Inputs:

The amount of lines (n) of input to build the square;
A square made from the following characters: ─ ┐ ┌ └ ┴ ┘ ┬ ├ ┤ ┼ | across n lines of input.

Output:

The amount of squares of any size that can fit within the input square (we only want a single number here, not a number for each size).

Winning criterion:
The smallest answer (number of bytes) wins.
Test Cases:
In:
5
┌─┬─┬─┬─┐
├─┼─┼─┼─┤
├─┼─┼─┼─┤
├─┼─┼─┼─┤
└─┴─┴─┴─┘

Out: 30

In:
3
┌─┬─┐
├─┼─┤
└─┴─┘

Out: 5

In:
5
┌─┬─┐
├─┴─┤
├───┤
├─┬─┤
└─┴─┘

Out: 7

In:
4
┌─┬─┬─┬─┬─┬─┐
├─┼─┼─┼─┼─┼─┤
├─┼─┼─┼─┼─┼─┤
└─┴─┴─┴─┴─┴─┘

Out: 32

In:
2
┌─┐
└─┘

Out: 1

In:
4
┌─┬─┬─┬─┬─┬─┐
├─┴─┼─┼─┼─┴─┤
├─┬─┼─┼─┼─┬─┤
└─┴─┴─┴─┴─┴─┘

Out: 22

I didn't count the bigger ones, but doesn't the third one have 11 squares in it?

@KevinLau-notKenny You're right I made a mistake.

I think is too simple, it is counted via a combinatoric form, would you rather prefer to consider the picture format of facebook?

Is the input always an nxm rectangle? (If so, can we just take m and n as input, rather than the height + ASCII art?)

@Agawa001 I'm not sure what you mean by combinatoric, but looking at the 1st test case, there are 16 1x1 squares, 9 2x2 squares, 4 3x3 squares and 1 4x4 square for a total of 30 sub squares. Unless I am completely missing something here, I don't think this is easy to come up with a concise answer.

@Sp3000 you can ignore the first line of input in your program if you want, but you cannot change the rest of the input.

@Sp3000 Alright learned a new word today, and yes, not saying it is impossible, just not too simple.

Actually, I should probably ask to be doubly clear: is the input always an n by m rectangle of unit squares? Because if there can be missing gridlines or other shapes then the problem does get harder.

@Sp3000 I guess I'll make it so we can be missing gridlines. It seems more interesting of a challenge. I originally intended for it to be a normal rectangle (n by m), but now that you mention it, it shouldn't be too hard to remove some grid lines to make the challenge harder.

For reference, the rectangular case is A271916, which gives m*(m+1)*(3*n-m+1)/6 for an m by n rectangle with n >= m (dimensions offset by one since the entry speaks of points rather than the squares themselves)

@SimonLandry i didnt mean combinatorics in pure sens, i think sp3000 just pointed that out already, the first version of your puzzle (before edit) was open for a simple mathematical breakthrough

@SimonLandry There are at least three different encodings of box drawing characters. Does it matter which encoding we use for the input? For example, in the list of inputs, | is the keyboard character having code 124.  All the others, are the unicode box-drawing-characters starting at code point U+2500.

@RootTwo Use whichever encoding you want as input as long as it is visually similar :)

JavaScript (ES6), 292 bytes 306 325
Edit I did the byte count totally wrong, corrected now thx http://bytesizematters.com/ correct for the last time I hope thx  Cᴏɴᴏʀ O'Bʀɪᴇɴ see https://goo.gl/LSHC1U (and 1 byte less using a literal newline insteads of '\n')
(h,z)=>(o=>{r=p=>" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);for(q=s=0;++s<o/2&s<h;)for(y=0;y<(h-s)*o;y+=o)for(x=0;x<o-s*2;q+=!n,x+=2)for(n=i=0,t=x,u=y;i<=s;t+=2,u+=o,i++)n|=i<s&(!(r(t+y)&r(t+y+s*o)&1)|!(r(x+u)&r(x+u+s*2)&2))|i>0&(!(r(t+y)&r(t+y+s*o)&4)|!(r(x+u)&r(x+u+s*2)&8))})(-~z.search`
`)|q

Longer than I expected (probably a few more byte can be shaved off)
All possible squares are checked and counted.
The r function map each character to a bitmap having

1 : horizontal line center to right
2 : vertical line center to bottom
4 : horizontal line center to left
8 : vertical line center to top

A square of any size must have

4 in all cells except the first in top and bottom row
1 in all cells except the last in top and bottom row
8 in all cells except the first in leftmost and rightmost column
2 in all cells except the last in leftmost and rightmost column

Test

f=(h,z)=>(o=>{r=p=>" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);k=(p,d,m)=>r(p)&r(p+s*d)&m;for(q=s=0;++s<o/2&s<h;)for(y=0;y<(h-s)*o;y+=o)for(x=0;x<o-s*2;q+=!n,x+=2)for(n=i=0,t=x,u=y;i<=s;t+=2,u+=o,i++)n=n|i<s&(!k(t+y,o,1)|!k(x+u,2,2))|i>0&(!k(t+y,o,4)|!k(x+u,2,8));})(-~z.search`
`)|q

console.log=(...x)=>O.textContent+=x+'\n'

// Less golfed

Uf=(h,z)=>{
  o=-~z.search`\n`;
  w=o/2;
  r=p=>" ),┌(─┐┬'└│├┘┴┤┼".search(z[p]);
  k=(p,d,m)=>r(p)&r(p+s*d)&m;
  for(q=s=0;++s<w&s<h;)
    for(y=0;y<(h-s)*o;y+=o)
      for(x=0;x<(w-s)*2;q+=!n,x+=2)
        for(n=i=0,t=x,u=y;i<=s;t+=2,u+=o,i++)
          n|=i<s&(!k(t+y,o,1)|!k(x+u,2,2))
          |i>0&(!k(t+y,o,4)|!k(x+u,2,8));
  return q
}

;[[5,`┌─┬───┬─┐
├─┼─┬─┼─┤
├─┼─┴─┼─┤
├─┼─┬─┼─┤
└─┴─┴─┴─┘`,20]
,[5,`┌─┬─┬─┬─┐
├─┼─┼─┼─┤
├─┼─┼─┼─┤
├─┼─┼─┼─┤
└─┴─┴─┴─┘`,30]
,[3,`┌─┬─┐
├─┼─┤
└─┴─┘`,5]
,[5,`┌─┬─┐
├─┴─┤
├───┤
├─┬─┤
└─┴─┘`,7]
,[4,`┌─┬─┬─┬─┬─┬─┐
├─┼─┼─┼─┼─┼─┤
├─┼─┼─┼─┼─┼─┤
└─┴─┴─┴─┴─┴─┘`,32]
,[2,`┌─┐
└─┘`,1]
,[4,`┌─┬─┬─┬─┬─┬─┐
├─┴─┼─┼─┼─┴─┤
├─┬─┼─┼─┼─┬─┤
└─┴─┴─┴─┴─┴─┘`,22],
,[6,`┌─┬─────┐
├─┼─┬─┐ │
│ ├─┼─┼─┤
│ └─┼─┼─┤
│   └─┼─┤
└─────┴─┘`,12],
,[6,`┌─┬─┬─┬─┐
├─┴─┼─┼─┤
│   └─┼─┤
├─┬─┬─┼─┤
├─┼─┼─┼─┤
└─┴─┴─┴─┘`,23]]
.forEach(t=>{
  var r=t[0],a=t[1],k=t[2],x=f(r,a)
  console.log(x==k?'OK '+x:'KO '+x+' Expected '+k,'\n'+a)
})

I count 307 bytes.

@Conor Ok thanks for the link


text:
Better way to read multiple int in C than scanf
I'm trying to read 4 ints in C in a golfing challenge and I'm bothered by the length of the code that I need to solve it:
scanf("%d%d%d%d",&w,&x,&y,&z)

that's 29 chars, which is huge considering that my total code size is 101 chars. I can rid of the first int since I don't really need it, so I get this code:
scanf("%*d%d%d%d",&x,&y,&z)

which is 27 chars, but it's still lengthy.
So my question is, is there any other way (tricks, functions, K&R stuff) to read ints that I don't know of that could help me reduce this bit of code?

Some users have reported that my question is similar to Tips for golfing in C
While this topic contain a lot of useful information to shorten C codes, it isn't relevant to my actual use case since it doesn't provide a better way to read inputs.
I don't know if there is actually a better way than scanf to read multiple integers (that's why I'm asking the question in the first place), but if there is, I think my question is relevant and is sufficiently different than global tips and tricks.
If there is no better way, my question can still be useful in the near future if someone find a better solution.
I'm looking for a full program (so no function trick) and all libraries possible. It needs to be C, not C++. Currently, my whole program looks like this:
main(w,x,y,z){scanf("%*d%d%d%d",&x,&y,&z)}

Any tricks are welcome, as long as they shorten the code (this is code golf) and work in C rather than C++.

@BusyBeingDelicious, welcome to PPCG! :) 2) To the close voters, this is not a general programming question. This is a [tag:tips] question which asks for help golfing code which is absolutely on topic.

I'm not sure it's possible to give a good answer without knowing anything about the problem domain at all.  I suspect the real answer is to figure out a way to only read one int at a time and/or abuse pointers.

@BusyBeingDelicious what are the constraints you are imposed or you do impose on us ? range of integers ? libraries used ? declarations of variables which you forgot to precede your piece of golfed code by ? are you considering c++ ?

@BusyBeingDelicious i m not sure what you are doing, the function you defined doesnt retain nothing because the variables stored are volatiles, look any function which does affect on addresses must encompasse pointers not simple integers.

I don't really get what you're talking about @Agawa001, the portion I show is using K&R C syntax . If you're talking about the fact that I don't use the variables afterwards, it's because it's not the full full code, just a piece of it. And it's also because the rest of the code isn't relevant to the actual question. If there is an answer, it could solve multiple cases that look like this one.

@BusyBeingDelicious do i seem to talk in cryptic way? i said functions which deal with addresses shouldnt carry simple values amongst their  parameters, you should define adresses of type int* between the finction's brackets.

This is almost certainly ungolfable, but you might be able to save two bytes taking advantage of how our rules allow you to not take unnecessary inputs.

@emanresuA It depends, if the user just wants to read the inputs only and not wanting to set them as variables then it's viable to use my solution

Thanks to @DialFrost for drawing my attention to this question.
I believe for reading 4 numbers your solution is optimal. However, I found a solution that saves bytes when reading 5 or more numbers at a time.
It will also consume the entire input (i.e. it can't be used in a loop).
Depending on the context it might help you with only 4 variables too
If you define your variables in a sequence like this:
a,b,c,d,e;main(){

In this case, the variables will be layed out in successive memory addresses, we can abuse that.
for(;~scanf("%d",&a+e);e++);

Full program:
// new
a,b,c,d,e;main(){for(;~scanf("%d",&a+e);e++);}
// original
a,b,c,d;main(e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);}

This 29 byte segment will paste all the input in successive variables starting in a. We re-use e, (the last variable) as the index variable. This saves declaring one variable.
Size comparison

Number of inputs
Original
New
Original (full program)
new (full program)

1
14
28
24
38

2
19
28
31
40

3
24
28
38
42

4
29
28
45
44

5
34
28
52
46

6
39
28
59
48

Note that the new method gains a 1 byte disadvantage in full programs because you can't use function arguments, however, this doesn't matter if you can use another variable as the argument to main.
Note there is also a slot in the initialization portion of the for loop. If you can put another expression there this method can save 1 byte even with only 4 arguments.
Try it online!
@JDT ponted out you can save 1 byte at the cost of having 1 added to e at the end:
for(;0<scanf("%d",&a+e++););

This 27 bytes gives the correct value for e but need an additional integer i to be declared on the global scope.

Nice find, including the declaration it's 1 extra byte but it could be useful if you have some other use for i afterwards

If you want to e.g. print all the inputs then we have this, being 64 bytes long:
main(x,y,z){scanf("%*d%d%d%d",&x,&y,&z);printf("%d%d%d",x,y,z);}

We can actually shorten this with a loop, bringing the total down to 47 bytes:
main(z){for(;scanf("%d",&z)>0;)printf("%d",z);}

So the reading part is only 23 bytes long:
for(;scanf("%d",&z)>0;)

Note that this only works when you don't want to assign a value to a specific variable and only want to read the values.
A method that is 29 bytes long:
for(;scanf("%d",&a+i)>0;i++);

Shout out to @mousetail for helping me out!

C (gcc),  44  43 bytes
main(i,a,b,c,d){for(;i+=scanf("%d",i+&i););

Try it online!
This frees up an extra integer i=0, while mousetail's solution make i=5(can't find a compiler that allow reusing e as index without adding extra 1)
Need -m32 maybe because on x64 values are passed via registers
C (tcc), 44 bytes
a,b,c,d,i;main(){for(;i+=scanf("%d",i+&a););

Try it online!

@mousetail How? I can only find one occurance of +=sc in this page

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Tips for golfing in Erlang
Does anybody have tips for golfing in Erlang? I'm looking for specific things that can be applied to Erlang, not any language. I know we already have tips for Elixir, but that is different.
As usual, please post separate tips in separate answers.

Use the ending conditions
Suppose you have a function reversing a list:
r([H|T])->[T]++r(H);r([])->[].

Since this is the only condition left, this can be golfed into:
r([H|T])->r(T)++[H];r(_)->[].

Or, since this is an identity function:
r([H|T])->r(T)++[H];r(I)->I.

You can also abuse the wild-cards in if statements. E.g.
if A<B->A;true->B end.

This can be golfed into:
if A<B->A;_->B end.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Contaminated Squares
Introduction
Let's observe the following square, consisting only of the digits 0 - 9:
1034
4167
8414
3542

The outer shell of this square is:
1034
4  7
8  4
3542

It contains zeros, so we need to peel off the outer shell, leaving:
16
41

The outer shell of this square is:
16
41

It does not contain any zeros and is therefore a non-contaminated square. So basically, the definition of a non-contaminated square is when the outer shell of the square contains no zeros.
The Task
Given a square of digits (containing only non-negative integers) in any reasonable format, output the largest non-contaminated square by constantly peeling off the outer shell, in any reasonable format.
Test cases
Test case 1:
Input         Output

1234          1234
2345          2345
3456          3456
4567          4567

Test case 2:
Input         Output

123           123
204           204
346           346

Test case 3:
Input         Output

101           1
010
101

Test case 4:
Input         Output

000           (none)
000
000

This is code-golf, so the submission with the least amount of bytes wins!

Can't I make the example 416\n841\n354\n (bottom-left corner)?

Well, you said "largest non-contaminated square"

Is error allowed?

@KennyLau You mean at the last test case? Yes, as long as it doesn't output 0 or something like that.

"Square of numbers" would be better stated as "square of digits"

@Mego Thanks! Edited it into the post.

Jelly, 19 16 bytes
Fœ^F}P
ḊṖZµ⁺⁸ßç?

Try it online! or verify all test cases.
How it works
ḊṖZµ⁺⁸ßç?  Main link. Argument: M (2D list)

Ḋ          Dequeue; remove the first row.
 Ṗ         Pop; remove the last row.
  Z        Zip; transpose rows with columns.
   µ       Combine the chain to the left into a link.
    ⁺      Copy the link, executing it twice.
           The copy removes the first and last column and restores the orientation.
       ç?  If the helper link returns a non-zero integer:
     ⁸       Return M unmodified.
      ß      Else, recursively call the main link on the "peeled" M.

Fœ^F}P     Helper link. Arguments: P ("peeled" M), M (unmodified)

F          Flatten P.
   F}      Flatten M.
 œ^        Perform multiset symmetric difference, removing the elements of P from
           the elements of M, respecting multiplicities, leaving precisely the
           elements of the outer shell.
     P     Return the product of the remaining elements.

JavaScript, 105 97 bytes
Saved 8 bytes thanks to @Patrick Roberts!
l=a=>a.slice(1,-1)
p=a=>l(a).map(l)
c=a=>a.join``.replace(/[^0]/g,"")
s=a=>c(p(a))<c(a)?s(p(a)):a

Defines function s, which returns a 2D array of integers when provided a 2D array of integers as input.
How it Works

function l: given an array a, returns a copy without its first and last indexes.

function p: given a 2D array a, calls l to remove the first and last row, then for each remaining row calls l to remove the fist and last column. This performs the onion peeling.

function c: given a 2D array a, returns a string that only contains the 0s in the stringified form of a.

function s: given a 2D array a, calls c on the peeled form of the array given by p, and on the array itself. Compares these strings lexicographically to determine if the peeled form has less 0s than the original. If it does, then the original is contaminated, so call s recursively on the peeled form. Otherwise return the original.

You can remove a.length from the end argument of array.slice in l and save 8 bytes. end is allowed to be a negative index.

Retina, 60 57 bytes
Byte count assumes ISO 8859-1 encoding. The trailing linefeed is significant.
+`(?<=(?=.*0|[^_]+(¶0|0¶|0.*$))^[^_]*)(^.+¶|¶.+$|.?\b.?)

Try it online!
Explanation
Due to the trailing linefeed, this finds all matches of the regex after the ` and removes them from the input. Due to the leading + this is done repeatedly until the output stops changing (which will be because the regex will stop matching).
As for the regex itself, it consists of two parts:
(?<=(?=.*0|[^_]+(¶0|0¶|0.*$))^[^_]*)

This part checks whether there's a 0 anywhere in the outer shell. It does this by moving the regex engine's "cursor" to the beginning of the string with a lookbehind (we use [^_] to match both digits and linefeeds):
(?<=...^[^_]*)

And then from that position we use a lookahead to find a 0 either in the first line, adjacent to a linefeed, or in the last line:
(?=.*0|[^_]+(¶0|0¶|0.*$))

Then the actual match will consist either of the first line (including its trailing linefeed), the last line (including its leading linefeed) or the first or last character of a line, where we abuse the word boundary \b as a beginning/end of line anchor:
(^.+¶|¶.+$|.?\b.?)

MATL, 26 21 bytes
t"t5LY)y5LZ)h?}6Lt3$)

Input is in the following format
[1 0 3 4; 4 1 6 7; 8 4 1 4; 3 5 4 2]

So the other four test cases are
[1 2 3 4; 2 3 4 5; 3 4 5 6; 4 5 6 7]
[1 0 1; 0 1 0; 1 0 1]
[1 2 3; 2 0 4; 3 4 6]
[0 0 0; 0 0 0; 0 0 0]

The program errors in the last test case, but produces the correct output (which is nothing). Thanks to @Dennis for noticing!
Try it online!. Or verify all test cases (this includes wrapping code).
Explanation
This iterates as many times as the number of columns in the input matrix, which is more than enough. At each iteration, the shell is removed or kept depending on its values.
t            % Take a matrix as input. Duplicate
"            % For each column (i.e. repeat that many times)
  t5LY)      %   Duplicate top of the stack. Extract first and last rows
  y5LZ)      %   Duplicate the element below the top. Extract first and last columns
  h          %   Concatenate the two arrays into a row vector
  ?          %   If all its entries are non-zero: do nothing
  }          %   Else
    6Lt3$)   %     Get the central part
             % End if, end for. Implicitly display

Pyth, 19 bytes
.W}\0.-`H`JutCPG2HJ

Test suite
.W}\0.-`H`JutCPG2HJ
.W                     While the first function returns true, apply the second
                       function, starting with the input.
           u    2H     Apply the following twice to the input:
              PG       Remove the last row
             C         Transpose
            t          Remove the first row
                       This removes the outermost shell.
          J            Save it to J
         `             Stringify the matrix
       `H              Stringify the input
     .-                Multiset difference
  }\0                  Check if there is a '0' in the resulting string.
                  J    If that succeeds, update the current value to J.
                       When it fails, return the current value.

JavaScript (ES6), 74 bytes
f=s=>/^.*0|0\n|\n0|0.*$/.test(s)?f(s.replace(/^.*\n?|.(.*).|\n.*$/g,"$1")):s

Takes input in the form of a string with newlines separating each row (but no leading or trailing newline). Explanation: /^.*0|0\n|\n0|0.*$/ is a regexp that matches contaminated squares, while /^.*\n?|.(.*).|\n.*$/ matches that parts of the square that need to be deleted, except for the (.*) which needs to be kept. (This is shorter than looking ahead or behind for the newline character.)

Perl 5, 63 + 3 = 66 bytes
$_=<>;s/\A.*\n?|^.|.$|\n.*\Z//mg while/\A.*0|0$|^0|0.*\Z/;print

Requires the -0 flag. Input should not contain a trailing newline character.

Pyke, 29 bytes
"D3lt%sBR,"2*ER3*I
/)tOmtmOr;

Try it here!
Also 29 bytes
QeQhQmhQme]4sBI
/)QtOmtmO=Qr;

Try it here!

I get errors in both links. Do we need to do anything before pressing "run"!

I should probably have mentioned that there will always be an error when ran. The output is on the second line somewhere (It is actually printed and not part of the error message)

Pyth, 31 30 bytes
L+hbeb.W!*F+1iRTs+yHyMHPtmPtdZ

Test suite. (The last testcase errors)
Improvement: made part the outer-loop extractor a function (L+hbeb).
Previous 31-byte version:
.W!*F+1iRTs++hHm+hdedHeHPtmPtdZ

How it works:
The code is basically: while the product of the outershell is zero, peel it.
Let us analyze the main code (Q is implicit here):
.W<lambda:H><lambda:Z>Q

Start from Q (input), while first lambda, perform second lambda.
The first part would be the lambda in H:
!*F+1iRTs++hHm+hdedHeH

The second part would be the lambda in Z:
PtmPtdZ

The first part
!*F+1iRTs++hHm+hdedHeH

Let us analyze this:
s++hHm+hdedHeH

s++             Concatenate:
   hH              1. the first row
     m+hdedH       2. the first and last item of each row
            eH     3. the last row

Since Pyth uses prefix notation, this would then get evaluated:
!*F+1iRT

     iRT  Convert each to integer
 *F+1     Product
!         Negate. If any element of the outer shell is zero, this would return 1.

The second part
PtmPtdZ
  mPtdZ   the inner of each row
Pt        the inner rows

Mathematica, 78 bytes
NestWhile[#[[a=2;;-2,a]]&,#,Count[{#[[b={1,-1}]],#[[;;,b]]},0,3]>0&]~Check~{}&

Anonymous function, takes input as a matrix. Ignore any errors that may result during execution.


text:
Smallest integers after N divisible by 2, 3, and 4
Give credit to whom credit is due.
Objective Given an integer N > 0, out the smallest integers A, B, and C so that:

All of A, B, and C are strictly greater than N;
2 divides A;
3 divides B;
and 4 divides C.

This is a code-golf, so the shortest answer in bytes wins.
Test cases
N => A, B, C
1 => 2, 3, 4
4 => 6, 6, 8
43 => 44, 45, 44
123 => 124, 126, 124
420 => 422, 423, 424
31415 => 31416, 31416, 31416
1081177 => 1081178, 1081179, 1081180

Can we (consistently) output the results in a different order (e.g. C B A) if it's clearly specified in the answer?

@MartinBüttner that is acceptable

Jelly, 8 bytes
~%2r4¤+‘

Try it online! or verify all test cases.
How it works
~%2r4¤+‘  Main link. Argument: n (integer)

~         Bitwise NOT; yield ~n = -(n + 1).
     ¤    Combine the three links to the left into a niladic chain:
  2         Yield 2.
   r4       Yield the range from 2 to 4, i.e., [2, 3, 4].
 %        Yield the remainder of the division of ~n by 2, 3 and 4.
          In Python/Jelly, -(n + 1) % k = k - (n + 1) % k if n, k > 0.
       ‘  Yield n + 1.
      +   Add each modulus to n + 1.

7 bytes

Python 2, 32 bytes
lambda n:[n+2&-2,n/3*3+3,n+4&-4]

Bit arithmetic for 2 and 4, modular arithmetic for 3.
I found four 7-byte expressions for the next multiple of k above n but none shorter:
n-n%k+k
~n%k-~n
n/k*k+k
~n/k*-k

Any gives 34 bytes when copies for k=2,3,4, and 33 bytes if combined:
[n/2*2+2,n/3*3+3,n/4*4+4]
[n/k*k+k for k in 2,3,4]

But, 2 and 4 are powers of 2 that allow bit tricks to zero out the last 1 or 2 bytes.
n+2&-2
n+4&-4

This gives 6 bytes (instead of 7) for getting the next multiple, for 32 bytes overall, beating the for k in 2,3,4.
Unfortunately, the promising-looking n|1+1 and n|3+1 have the addition done first, so incrementing the output takes parentheses.

Of the possible variants my preference is for n+k-n%k.

Does n&3+1 do the addition first too?

@Tim Yup, same with all boolean operations.

Julia, 16 bytes
n->n-n%(r=2:4)+r

Try it online!

MATL, 15 10 9 bytes
2:4+t5M\-

Try it online!
Explanation:
2:4          #The array [2, 3, 4]
   +         #Add the input to each element, giving us [12, 13, 14]
    t        #Duplicate this array
     5M      #[2, 3, 4] again
       \     #Modulus on each element, giving us [0, 1, 2]
        -    #Subtract each element, giving us [12, 12, 12]

Nice answer! You can save a byte by using 5M (automatic clipboard of function inputs) instead of the second 2:4.

@David Thanks for the tip!

MATL, 8 bytes
Qt_2:4\+

Uses Denis' Jelly algorithm, I'm surprised it's the same length!
Try it online, or, verify all test cases.
Q    % takes implicit input and increments by one
t_   % duplicate, and negate top of stack (so it's -(n+1))
2:4  % push vector [2 3 4]
\    % mod(-(n+1),[2 3 4])
+    % add result to input+1
     % implicit display

Well darn it. I was really proud of my 10 byte solution, but I can't beat this. Also, fun trivia: This is exactly my 300th vote. =D

Ahh but this was just taking Agawa/Dennis' algorithm, it isn't my own idea.

sometimes i keep glaring at those unicode mandarinoid elementary characters while scratching my head then i say "for sake of everything readable is that a forking runnable code" ? lol nice thing have my upvote + i ll join the matl train sooon.

@Agawa001 You should! Given know your way around Matlab pretty well, you should find it fairly straightforward, the big difference is that MATL s stack-based. There is a MATL chat-room too if you need any help!

@David that pancake based nature of matl makes it more evil scary knowignly that the raw matlab itself is a golf-friendly language regarding its high-level interactability , so imagine ....

Matlab, 33 bytes
Another slightly different approach
@(a)feval(@(x)a+1+mod(-a-1,x),2:4)

05AB1E, 8 bytes
Code:
>D(3L>%+

Try it online!.

Ah, didn't notice there was already an 05AB1E answer which is rather similar as what I had. I've deleted it, and will suggest it as a -1 golf here instead: ±D2xŸ%α (the 2xŸ is just an alternative for your 3L>; and two other equal-byte alternatives could be Ƶ…S or 4L¦).

Ruby, 27 bytes
Maps 2, 3, and 4 to the next multiple above n.
->n{(2..4).map{|e|n+e-n%e}}

Pyth, 11 10 bytes
m*dh/QdtS4

Test suite.
       tS4  generate range [2, 3, 4]
m           for d in range...
 *dh/Qd       d*(1+input/d)

Thanks to Dennis for a byte!

CJam, 15 bytes
5,2>rif{1$/)*N}

Try it online! or verify all test cases.

C, 50 46 bytes
i;f(int*a,int n){for(i=1;++i<5;*a++=n+i-n%i);}

Thanks to Neil and  nwellnhof for saving 4 bytes!
Disappointingly long. I feel like there's some bit-shifting hack in here that I don't know about, but I can't find it yet. Returns a pointer to an array holding the three elements. Full program:
i;f(int*a,int n){for(i=1;++i<5;*a++=n+i-n%i);}

int main()
{
    int array[3];
    int n=10;
    f(array, n);
    printf("A:%d\tB:%d\tC:%d\n",array[0],array[1],array[2]);
    return 0;
}

I looked at @xnor's bit-twiddling but you need to unroll the loop for that which ends up costing you a byte overall.

Doesn't n + i - n % i++ result in undefined behavior?

Also s/a[i-2]/*a++/ to save two bytes.

@nwellnhof Bah, I thought of that when I unrolled his loop but it didn't occur to me that he could use it anyway.

@nwellnhof By my understanding of PPCG rules I think it's acceptable if you can find an implementation on which it works.

@Neil But the undefined behavior can be worked around without making the code larger. Here's an even shorter version using K&R function declarations: f(a,n,i)int*a;{for(i=1;++i<5;)*a++=n+i-n%i;}

Pyke, 11 9 8 bytes
3FODQRc+

Try it here!
3FODQRc+
         - Q = input()
3F       - for i in range(3): # for i in [0,1,2]
  O      -  i += 2
    Q c  -   Q-(Q%i)
       + -  i+^

Mathematica, 21 bytes
Ceiling[#+1,{2,3,4}]&

This is an unnamed function which takes a single integer as input and returns a list of the multiples.
The Ceiling function takes an optional second parameter which tells it to round up to the next multiple of the given number. Thankfully, it also automatically threads over its second argument such that we can give it a list of values and in turn we'll get rounded up multiples for all of those.

Octave, 20 bytes
@(n)n-mod(n,d=2:4)+d

Examples:
octave:60> f(123)
ans =

   124   126   124

octave:61> f(1081177)
ans =

   1081178   1081179   1081180

octave:62> f(420)
ans =

   422   423   424

Worth noting that we can do this up to 9 without adding any extra bytes:
@(n)n-mod(n,d=2:9)+d

Output (2520 is the smallest positive integer evenly divisible by all the single digit numbers):
octave:83> f(2520)
ans =

   2522   2523   2524   2525   2526   2527   2528   2529

Haskell, 27 bytes
f n=[div n d*d+d|d<-[2..4]]

Reng, 40 bytes
i1+#i2341ø>(1+)31j
i(2[¤,  q!^$]æl0eq!~

1: init
i1+#i2341ø

i1+#i sets the input to 1 + input; this is because we are to work on the numbers strictly greater than the input. 234 initializes the tape with our iteration values, and 1ø jumps to the beginning of the next line.
2a: loop
i(2[¤,  q!^$]æl0eq!~

i( puts the input at the STOS, and 2[ makes a new stack with the top 2 elements. ¤ duplicates the stack, and , does modulus. If there is a remainder, q!^ breaks out of the loop to go to (b). Otherwise, we're fine to print. $ removes the extra thingy, ] closes the stack, and æ prints it nicely. l0wq!~ terminates iff the stack contains zero members.
2b: that other loop
          >(1+)31j
        q!^

(1+) adds 1 to the STOS, and 31j jumps to the part of the loop that doesn't take stuff from the stack. And profit.

That extra whitespace is really bothering me. Take a GIF.

Labyrinth, 19 bytes
:?
:
#/)
\ #
!"*@
"

Try it online!
This outputs the results in the order C, B, A separated by linefeeds.
Explanation
As usual, a short Labyrinth primer:

Labyrinth has two stacks of arbitrary-precision integers, main and aux(iliary), which are initially filled with an (implicit) infinite amount of zeros. We'll only be using main for this answer.
The source code resembles a maze, where the instruction pointer (IP) follows corridors when it can (even around corners). The code starts at the first valid character in reading order, i.e. in the top left corner in this case. When the IP comes to any form of junction (i.e. several adjacent cells in addition to the one it came from), it will pick a direction based on the top of the main stack. The basic rules are: turn left when negative, keep going ahead when zero, turn right when positive. And when one of these is not possible because there's a wall, then the IP will take the opposite direction. The IP also turns around when hitting dead ends.

Despite the two no-ops (") which make the layout seem a bit wasteful, I'm quite happy with this solution, because its control flow is actually quite subtle.
The IP starts in the top left corner on the : going right. It will immediately hit a dead end on the ? and turn around, so that the program actually starts with this linear piece of code:
:   Duplicate top of main stack. This will duplicate one of the implicit zeros
    at the bottom. While this may seem like a no-op it actually increases
    the stack depth to 1, because the duplicated zero is *explicit*.
?   Read n and push it onto main.
:   Duplicate.
:   Duplicate.

That means we've now got three copies of n on the main stack, but its depth is 4. That's convenient because it means we can the stack depth to retrieve the current multiplier while working through the copies of the input.
The IP now enters a (clockwise) 3x3 loop. Note that #, which pushes the stack depth, will always push a positive value such that we know the IP will always turn east at this point.
The loop body is this:
#   Push the stack depth, i.e. the current multiplier k.
/   Compute n / k (rounding down).
)   Increment.
#   Push the stack depth again (this is still k).
*   Multiply. So we've now computed (n/k+1)*k, which is the number
    we're looking for. Note that this number is always positive so
    we're guaranteed that the IP turns west to continue the loop.
"   No-op.
!   Print result. If we've still got copies of n left, the top of the
    stack is positive, so the IP turns north and does another round.
    Otherwise, see below...
\   Print a linefeed.
    Then we enter the next loop iteration.

After the loop was traversed (up to !) three times, all copies of n are used up and the zero underneath is revealed. Due to the " at the bottom (which otherwise seems pretty useless) this position is a junction. That means with a zero on top of the stack, the IP tries to go straight ahead (west), but because there's a wall it actually makes a 180 degree turn and moves back east as if it had hit a dead end.
As a result, the following bit is now executed:
"   No-op.
*   Multiply two zeros on top of the stack, i.e. also a no-op.
    The top of the stack is now still zero, so the IP keeps moving east.
@   Terminate the program.

Minkolang 0.15, 17 bytes
n$z3[zi2+$d%-+N].

Try it here!
Explanation
n$z                  Take number from input and store in register
   3[                Open for loop that repeats 3 times
     z               Push value in register on stack
      i2+            Loop counter plus 2
         $d          Duplicate stack
           %-+       Mod, subtract, add
              N      Output as number
               ].    Close for loop and stop.

is division??

@Downgoat: Whoops. >_>

Matlab, 50 bytes
@(a)arrayfun(@(k)find(~rem(a+1:a+k,k))+a,[2 3 4])

At the very least, you can use 2:4 instead of [2 3 4].

Retina, 62 43 26 bytes
17 bytes thanks to @Martin Büttner.

^
1111:
M!&`(11+):(\1*)
:

(Note the trailing newline.)
Try it online!
Input in unary in 1, output in unary in 1 separated by newlines.
Previous 43-byte version:
.+
11:$&;111:$&;1111:$&
\b(1+):(\1*)1*
$1$2

Try it online!
Input in unary, output in unary separated by semi-colon (;).
Previous 62-byte version:
.+
$&11;$&111;$&1111
((11)+)1*;((111)+)1*;((1111)+)1*
$1;$3;$5

Try it online!
Input in unary, output in unary separated by semi-colon (;).

26 if output in the opposite order is allowed: http://retina.tryitonline.net/#code=XgoxMTExOgpNISZgKDExKyk6KFwxKikKOgo&input=MTExMQ ... Otherwise 33 although I think there must be a shorter way that avoids the reverse sorting: http://retina.tryitonline.net/#code=XgoxMTExOgpNISZgKDExKyk6KFwxKikKOgoKTyReYC4r&input=MTExMQ

That's enough to qualify as a separate answer?

I don't know, it's still the same idea, I just replaced generating the list manually with using overlapping matches.

Conor confirmed that the 26-byte solution is valid.

JavaScript (ES6), 26 bytes
Interestingly porting either @KevinLau's Ruby answer or @xnor's Python answer results in the same length:
n=>[2,3,4].map(d=>n+d-n%d)
n=>[n+2&-2,n+3-n%3,n+4&-4]

I have a slight preference for the port of the Ruby answer as it works up to 253-3 while the port of the Python answer only works up to 231-5.

) -> ] as I think

@Qwertiy Whoops, sorry for the typo.

Octave, 27 22 20 bytes
MATLAB and Octave:
f=2:4;@(x)f.*ceil((x+1)./f)

Better (solutions are equivalent, but one may outperform the other when further golfed), MATLAB and Octave:
@(x)x-rem(x,2:4)+(2:4)
f=2:4;@(x)x+f-rem(x,f)

Only in Octave:
@(x)x-rem(x,h=2:4)+h

Try here.

My final answer is basically that one here :( http://codegolf.stackexchange.com/a/80028/52795

APL (Dyalog Unicode), 11 bytes
-1 thanks to Adam
⎕(+-|⍨)1+⍳3

Try it online!
Explanation:
⎕(+-|⍨)1+⍳3
       1+⍳3    ⍝ 2 3 4
⎕              ⍝ read n
  +-|⍨          ⍝ {⍺ + ⍵ - ⍵ | ⍺}

Let's look at how {⍺ + ⍵ - ⍵ | ⍺} is transformed to +-|⍨:

        {⍺ + ⍵ - ⍵ | ⍺}
       {⍺} + {⍵ - ⍵ | ⍺}
         ⊣ + ({⍵} - {⍵ | ⍺})
         ⊣ + (⊢ - ({⍵} | {⍺}))
         ⊣ + (⊢ - (⊢ | ⊣))
        (⊣ + ⊢ - (⊢ | ⊣))
          (+ - (⊢ | ⊣))
          (+ - (⊣ |⍨ ⊢))
          (+ - (|⍨))
          (+-|⍨)

+ and - and | are scalar functions, so ¨ isn't needed here.

No need for ⎕←

i.. think that's how my solution already looks like?

Sure, but you don't need ⎕← on TIO either, making the code length easier to understand.

><>, 31 bytes
&2v
:&\&
?!\1+:{:}%
ao\n1+:5=?;

Expects N to be present on the stack at program start. Try it online!

R, 30 26 bytes
(Reduced 4 bytes thanks to @Neil)
N=scan();cat(N+2:4-N%%2:4)

This (similarly to the rest of the answers I guess) adds 2:4 to the input and the reduces the remainder after running modulo on the same numbers.

As I don't know the language, is there a reason you don't use N+2:4-N%%2:4?

@Neil Cause I haven't thought of it I guess. Thanks though.

UGL, 51 31 25 24 bytes
icu$l_u^^/%_u^*ocO$dddd:

Try it online!
Previous 25-byte version:
iRcu$l_u$r^/%_u*ocO$dddd:

Try it online!
Previous 31-byte version:
iRcuuulu$cuuuuuu%-r^/%_u*oddcO:

Try it online!
Previous 51-byte version:
i$$cuuu/%_ucuuu*@cuuuu/%_ucuuuu*@cuu/%_ucuu*ocOocOo

Try it online!

Mathematica 28 bytes
f@n_:=n-n~Mod~#+#&/@{2,3,4}

f[1]
f[4]
f[43]
f[123]
f[420]
f[31415]
f[1081177]

{2, 3, 4}
{6, 6, 8}
{44, 45, 44}
{124, 126, 124}
{422, 423, 424}
{31416, 31416, 31416}
{1081178, 1081179, 1081180}

The general case produces a general answer:
f[r]

{2 + r - Mod[r, 2], 3 + r - Mod[r, 3], 4 + r - Mod[r, 4]}

Java 70 57
a->System.out.print(a/2*2+2+" "+(a/3*3+3)+" "+(a/4*4+4))

I don't know Java, but perhaps you can remove the white space around = in int a = new Integer(z[0]);

><>, 28 bytes
i2&::&::&@%-+nao&1+:&5=?;20.

How it Works
i2&::&::&@%-+nao&1+:&5=?;20.
i2&                                  Takes N as input and stores 2 in the register
   ::                                Duplicates N twice
     &::&                            Pushes the register onto the stack and duplicates twice
          @                          Shifts top the 3 values in the stack to the right
                                     Stack now looks like: N N & N & (& = register)
            %-+nao                   Computes the smallest multiple of k > N: N+k-N%k, where k is the value of the register
               nao                   Outputs answer and a newline.
                  &1+:&5=?;          Increments register by 1, ends the program if the register equals 5
                           20.       Jumps back into the loop, skipping taking input and initializing the register

You could save a byte if you are allowed to take input by initializing the stack with N, but TIO doesn't allow for that. The interpreter on https://fishlanguage.com/ does.
2&::&::&@%-+nao&1+:&5=?;10.

Try it online!

Vyxal r, 8 bytes
3ɾ›ƛ⁰/⌈*

Try it Online!
-1 thanks to lyxal
 ɾ       # Range 1...
3        # Literal
  ›      # Incremented (2...4)
   ƛ     # Map to...
       * # Product of...
          # Current item (implicit)
       * # And...
      ⌈  # Floor of
         # (Implicit) current item
     /   # Divided by...
    ⁰    # Input

Try it Online! for 8 bytes

@lyxal Nice! I forgot implicit input worked like that.

J, 18 bytes
2 3 4&([*>:@<.@%~)

Try it online!

Golfscript, 22 bytes
~..2/)2*@3/)3*@4/)4*]`

Try it online!
Alternative 22-byte solution:
~..[4 2 3]{.@@/)*@}/]`

Try it online!

Actually, 22 bytes
╗52x"╝1`;╛@%Y@╜<*`╓"£M

Try it online!
Fun fact: 3 bugs in Actually's interpreter were found and fixed while writing this program.
Not so fun fact: Those 3 bugs prevented this solution from being much shorter.
Explanation:
╗52x"╝1`;╛@%Y@╜<*`╓"£M
╗                       push input to reg0
 52x                    push range(2,5) ([2,3,4])
    "╝1`;╛@%Y@╜<*`╓"£M  map (for n in [2,3,4]):
     ╝                    push n to reg1
      1`;╛@%Y@╜<*`╓       find the smallest integer k where:
        ;╛@%Y               k is divisible by n and...
             @╜<*           is greater than the input

Mathcad, [tbd] bytes

function version allows for simple evaluation of different divisor sets.

Mathcad byte equivalence scheme not yet determined.   Keyboard equivalence ~ 16 bytes.

Desmos, 141 136 bytes
a=1
b=2\operatorname{ceil}\left(.5a+.1\right)
c=3\operatorname{ceil}\left(\frac{a}{3}+0.1\right)
d=4\operatorname{ceil}\left(.25a+.1\right)

Demonstration
Fixed the outputs while shaving off a few bytes.

Also, it's possible to remove the a=1\n. Having the user click on the a to set it is equivalent input.

But doing that would create an error.

Brachylog, 12 bytes
Ṫ;234z%ᵛ0&>ᵛ

Try it online!
Takes input through the output variable and gives output through the input variable. (Shortest I could get it without reversed I/O was ~{>ᵛ}Ṫ;234z%ᵛ0∧Ṫ, which at 16 bytes ties an extremely awkward implementation of Dennis' algorithm: +₁Xṅg;234z%ᵐ+ᵐ↙X.)
           ᵛ    Every element of
         &      the input variable
          >     is strictly greater than
                the output variable.
                Also, the input variable
Ṫ               is a list of three elements
     z          which zipped
 ;234           with 2, 3, and 4
       ᵛ0       produces 0 for each pair
      %         when the first element is taken mod the second.

Japt, 8 bytes
3õ@Ä c°X

Try it

Forth (gforth), 40 bytes
: f 5 2 do dup i over i mod - + . loop ;

Try it online!
Explanation
Uses modulo of 2, 3, and 4 to get the distance to the next divisible number and then adds it to the original number (+1)
Code Explanation
: f                \ start a new word definition
  5 2              \ set up parameters loop from 2 to 4
  do               \ start a counted loop
    dup i over     \ duplicate N, get the loop index, and then copy N again
    i mod          \ get N mod Loop-index (distance from last divisible number)
    -              \ subtract from Loop-index to get distance to next divisible number
    +              \ add distance-to-next to N to get number
    .              \ print
  loop             \ end counted loop
;                  \ end word definition

Java (JDK), 141 129 bytes
interface C{static void main(String[]a){var n=Double.valueOf(a[0])+1;for(int i=1;++i<5;)System.out.print(i*Math.ceil(n/i)+" ");}}

Try it online!
You may notice that no class has been defined, but instead an interface. This is just to further golf the code. Since the interface hasn't been given a public access modifier, the main method doesn't need it, either.
For a better understanding of this code, it's shown below with the variable a remnamed to its traditional name args:
var n = Double.valueOf(args[0]) + 1;
for (int i = 1; ++i < 5;)
    System.out.print(i * Math.ceil(n / i) + " ");
}

The program inputs a value as a command-line argument which is immediately incremented for compactness before being stored in the double variable n. Next, the for loop cycles through each integer i from 2 through to 4, printing the output values each cycle. See here for an interactive demonstration of the formula used to calculate said values.
In order to further golf this code, I think finding a way to use Java 6 would be ideal due to the static block's functionality, as expressed below:
public class Foo {
    static {
        // Your code here
    }
}

As you can see, although it's definitely good practice, explicitly defining the main method isn't necessary in this particular version of Java. (Correct me if that was incorrectly phrased)
Unfortunately, in performing such a conversion, the var keyword would no longer exist (since it was introduced in Java 10). More importantly, reconstructing the value input mechanism would be necessary, since a static block obviously doesn't have any method parameters, and especially not for command-line arguments. Feel free to leave comments and suggestions.

C (gcc), 41 bytes
i=5;f(int*n){for(;--i;n[i-2]=*n+i-*n%i);}

Try it online!

MMIX, 36 bytes (9 instrs)
Uses bit tricks to avoid dividing by 2 or 4 (sadly, it's unavoidable for 3)
foo ADDU $2,$0,1        // a = n + 1
    ANDN $2,$2,1        // a &= ~1
    ADDU $1,$0,3        // c = n + 3
    PUT  rD,0
    DIVU $0,$0,3
    GET  $0,rR          // b = n % 3
    SUBU $0,$1,$0       // b = c - b (= n + 3 - n % 3)
    ANDN $1,$1,3        // c &= ~3
    POP  3,0            // return a,b,c

Scala, 268 bytes
def logic(y:Int)(x: Int) = (x)%y ==0

def fun(n:Int,  logic: Int => Boolean) : Int = {
  if (logic(n)) n else fun(n+1, logic)
}
for {
    N <- Array[Int](1,4, 43, 123, 420, 31415, 1081177)
    ABC <- Array[Int](2,3,4)
    res = fun(x+1, logic(i) _)
    } yield res

Scala version...

Welcome to PPCG! Please include your language's name on the header. This made me realize it is Scala. Please include your bytecount along with the header, since this is [tag:code-golf].

Perl 5 -n, 26 bytes
//;map{say$'+$_-$'%$_}2..4

Try it online!

Perl 6, 25 bytes
{[$^a+$_-$a%$_ for 2..4]}

Try it online!

Arm Thumb (no div), 30 bytes
Raw machine code:
3001 1c42 2301 439a 600a 2302 3202 439a
608a 1c03 3b03 dcfd 1ac0 6048 4770

Uncommented assembly:
        .text
        .thumb
        .globl smallest_after_n
        .thumb_func
smallest_after_n:
        adds    r0, #1
        adds    r2, r0, #1
        movs    r3, #1
        bics    r2, r3
        str     r2, [r1]
        movs    r3, #2
        adds    r2, #2
        bics    r2, r3
        str     r2, [r1, #8]
        movs    r3, r0
.Lmod_loop:
        subs    r3, #3
        bgt     .Lmod_loop
.Lmod_loop_end:
        subs    r0, r3
        str     r0, [r1,#4]
        bx      lr

Explanation
Happens to be valid Thumb-1, but feel free to use Thumb-2 to compete.
It is easier to understand in the equivalent C code.
void smallest_after_n(int32_t N, int32_t out[3])
{
    ++N; // increment N
    // Even multiple of 2: Lowest bit is zero.
    int32_t A = (N + 1) & ~1;
    out[0] = A;
    // Even multiple of 4: Lowest 2 bits are zero.
    // Since we know the lowest bit of A is zero, we reuse it.
    int32_t C = (A + 2) & ~2;
    out[2] = C;
    // Calculate the "inverse modulo" using a subtraction loop.
    // N % 3 == 0 => 0
    // N % 3 == 1 => -2
    // N % 3 == 2 => -1
    int32_t inv_modulo = N;
    while ((inv_modulo -= 3) > 0) {}
    // Round up by subtracting a negative
    int32_t B = N - inv_modulo;
    out[1] = B;
}

Arturo, 25 bytes
$[n][map 2..4'd->d+n-n%d]

Try it

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes
DA~234d%+1+

Attempt This Online!
Port of Dennis's Jelly answer.
Explanation
DA~234d%+1+  # Implicit input
DA~          # Duplicate and bitwise not
   234d      # Push [2, 3, 4] (digits of 234)
       %     # Push ^^ modulo ^
        +1+  # Add and increment


text:
Bootloader golf: Brainf***
Create a bootloader that executes given Brainfuck program. This is code-golf, so the program with least bytes wins. Being a bootloader, the size of the program is counted in non-zero bytes in the compiled code.
Brainfuck
30000 8-bit overflowing cells. Pointer wraps over.
Some notes about operations:

Input must be read in a way that all printable ASCII characters are correctly supported. Other keystrokes may either insert an arbitrary character or do nothing at all.
Reading user input must be character buffered, not line buffered.
Reading user input must echo inserted character.
Output must follow either the code page 437 or your built-in VGA adapters default codepage.

Bootloader
This is a x86 bootloader. A bootloader ends with the traditional 55 AA sequence. Your code must run either on VirtualBox, Qemu or other well-known x86 emulator.
Disk
Executable Brainfuck is located at second disk sector, right after your bootloader, which is placed, as usually, in MBR section, the first sector on disk. Additional code (any code over 510 bytes) can be located at other disk sectors. Your storage device must be either a hard drive or a floppy disk.
STDIO
Of course, a bootloader cannot have an access to the operating system's IO capabilities. Therefore BIOS functions are used instead for printing text and reading user input.
Template
To get started, here is a simple template written in Nasm (intel syntax) assembly:
[BITS 16]
[ORG 0x7c00]

; first sector:

boot:
    ; initialize segment registers
    xor ax, ax
    mov ds, ax
    mov es, ax
    mov ss, ax

    ; initialize stack
    mov sp, 0x7bfe

    ; load brainfuck code into 0x8000
    ; no error checking is used
    mov ah, 2       ; read
    mov al, 1       ; one sector
    mov ch, 0       ; cylinder & 0xff
    mov cl, 2       ; sector | ((cylinder >> 2) & 0xc0)
    mov dh, 0       ; head
                    ; dl is already the drive number
    mov bx, 0x8000  ; read buffer (es:bx)
    int 0x13        ; read sectors

; fill sector
times (0x200 - 2)-($-$$) db 0

; boot signature
db 0x55, 0xaa

; second sector:

db 'brainfuck code here'

times 0x400-($-$$) db 0

Compiling this is pretty easy:
nasm file.asm -f bin -o boot.raw

And the run it. For example, with Qemu:
qemu-system-i386 -fda boot.raw

Addtional information: OsDev wiki, Wikipedia

Input must be red I'm pretty sure most bootloaders don't natively support color.

One should explain to younger developers what a floppy disk is!

@bobbel Let's start with bootloader

Not that I find this title offensive, but how is it possible? According to meta, it's impossible to put "brainfuck" in the title.

Can we use more than 30k cells?

171 bytes1
Wooohoooo! It took half the day, but it was fun...
So, here it is. I think it conforms to the specs (wraparound of cell pointer, echo of characters on input, reading char by char, echo of input chars, ...), and it seems to actually work (well, I didn't try many programs, but given the simplicity of the language, the coverage isn't that bad, I think).
Limitations
One important thing: if your brainfuck program contains other chars than the 8 brainfuck instructions, or if the [] are not well-balanced, it will crash on you, mouhahahaha!
Also, the brainfuck program can't exceed 512 bytes (a sector). But this seems conforming since you say "executable Brainfuck is located at second disk sector".
Last detail: I didn't explicitly initialized the cells to zero. Qemu seem to do it for me, and I'm relying on this, but I don't know whether a real BIOS on a real computer would do it (initialization would just take a few bytes more, anyway).
The code
(based on your template, and by the way, thanks for this, I would never have tried without it):
[BITS 16]
[ORG 0x7C00]

%define cellcount 30000 ; you can't actually increase this value much beyond this point...

; first sector:

boot:
    ; initialize segment registers
    xor ax, ax
    mov ss, ax
    mov ds, ax
    mov es, ax
    jmp 0x0000:$+5

    ; initialize stack
    mov sp, 0x7bfe

    ; load brainfuck code into 0x8000
    ; no error checking is used
    mov ah, 2       ; read
    mov al, 1       ; one sector
    mov ch, 0       ; cylinder & 0xff
    mov cl, 2       ; sector | ((cylinder >> 2) & 0xc0)
    mov dh, 0       ; head
                    ; dl is already the drive number
    mov bx, 0x8000  ; read buffer (es:bx)
    int 0x13        ; read sectors

    ; initialize SI (instruction pointer)
    mov si, bx ; 0x8000
    ; initialize DI (data pointer)
    mov bh, 0x82
    mov di, bx ; 0x8200

decode:
    lodsb ; fetch brainfuck instruction character
.theend:
    test al, al ; endless loop on 0x00
    jz .theend
    and ax, 0x0013 ; otherwise, bit shuffling to get opcode id
    shl ax, 4
    shl al, 2
    shr ax, 1
    add ax, getchar ; and compute instruction implementation address
    jmp ax

align 32, db 0

getchar:
    xor ah, ah
    int 0x16
    cmp al, 13
    jne .normal
    mov al, 10 ; "enter" key translated to newline
.normal:
    mov byte [di], al
    push di
    jmp echochar

align 32, db 0

decrementdata:
    dec byte [di]
    jmp decode

align 32, db 0

putchar:
    push di
    mov al, byte [di]
echochar:
    mov ah, 0x0E
    xor bx, bx
    cmp al, 10 ; newline needs additional carriage return
    jne .normal
    mov al, 13
    int 0x10
    mov al, 10
.normal:
    int 0x10
    pop di
    jmp decode

align 32, db 0

incrementdata:
    inc byte [di]
    jmp decode

align 32, db 0

decrementptr:
    dec di
    cmp di, 0x8200 ; pointer wraparound check (really, was that necessary?)
    jge decode
    add di, cellcount
    jmp decode

align 32, db 0

jumpback:
    pop si
    jmp jumpforward

align 32, db 0

incrementptr:
    inc di
    cmp di, 0x8200+cellcount  ; pointer wraparound check
    jl decode
    sub di, cellcount
    jmp decode

align 32, db 0

jumpforward:
    cmp byte [di], 0
    jz .skip
    push si
    jmp decode
.skip:
    xor bx, bx ; bx contains the count of [ ] imbrication
.loop:
    lodsb
    cmp al, '['
    je .inc
    cmp al, ']'
    jne .loop
    test bx, bx
    jz decode
    dec bx
    jmp .loop
.inc:
    inc bx
    jmp .loop

; fill sector
times (0x1FE)-($-$$) db 0

; boot signature
db 0x55, 0xAA

; second sector contains the actual brainfuck program
; currently: "Hello world" followed by a stdin->stdout cat loop

db '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.,[.,]'

times 0x400-($-$$) db 0

Tricks used
Ok, I cheated a bit. Since you said "being a bootloader, the size of the program is counted in non-zero bytes in the compiled code", I made the code smaller by allowing "holes" between the implementation of the eight brainfuck opcodes. This way, I don't need a big sequence of tests, a jump table, or anything: I just jump to the brainfuck "opcode id" (from 0 to 8) multiplied by 32 to execute the brainfuck instruction (worth to note that it means the implementation of the instructions can't take more than 32 bytes).
Moreover, to get this "opcode id" from the brainfuck program character fetched, I noticed just a bit of bit shuffling was necessary. Indeed, if we just consider bits 0, 1 and 4 of the opcode character, we end up with the 8 unique combinations:
   X  XX
00101100 0x2C , Accept one byte of input, storing its value in the byte at the pointer.
00101101 0x2D - Decrement (decrease by one) the byte at the pointer.
00101110 0x2E . Output the value of the byte at the pointer.
00101011 0x2B + Increment (increase by one) the byte at the pointer.
00111100 0x3C < Decrement the pointer (to point to the next cell to the left).
01011101 0x5D ] Jump back after the corresp [ if data at pointer is nonzero.
00111110 0x3E > Increment the pointer (to point to the next cell to the right).
01011011 0x5B [ Jump forward after the corresp ] if data at pointer is zero.

And, lucky me, there is actually one opcode that requires more than 32 bytes to implement, but it's the last one (jump forward [). As there is more room after, everything is fine.
Other trick: I don't know how a typical brainfuck interpreter works, but, to make things much smaller, I did not actually implement ] as "Jump back after the corresponding [ if data at pointer is nonzero". Instead, I always go back to the corresponding [, and, from here, re-apply the typical [ implementation (which then, eventually, goes forward after the ] again if needed). For this, each time I encouter a [, I put the current "brainfuck instruction pointer" on the stack before executing the inner instructions, and when I encounter a ], I pop back the instruction pointer. Pretty much as if it was a call to a function. You could therefore theoretically overflow the stack by making many many imbricated loops, but not with the current 512-bytes limitation of the brainfuck code, anyway.

1. Including the zero bytes that were part of the code itself, but not those that were part of some padding

WIP?

Can you even place code after 0x400


text:
Inverse regex of compound interest
Koronkorko is the Finnish word for compound interest. We don't want compound interest in our strings, so let's find the shortest possible regular expression to exclude it.
Given a string consisting only of the uppercase alphabetic characters A-Z, determine the shortest possible regular expression that matches the string if it does not contain the substring KORONKORKO. Any string that contains KORONKORKO as a substring should not be matched by the regex.
Only the characters A-Z, [, ], -, ^, , ?, *, +, |, (, and ) should be used in the expression.
I think this can be done with 118 characters in the expression. Can you make it shorter?
Note: This challenge is from Ohjelmointiputka (in Finnish).

If ! was an allowed character, you could've done ^((?!KORONKORO).)*$ for 19 bytes.

@MamaFunRoll I think that's why ! isn't allow.

I had the fun of trying to work my way around the Finnish site, and I believe what you're looking for are theoretical regex expressions which match/reject the input string. For example, the site only seems to allow the use of - and ^ inside character classes (so ^ can't be used as an anchor), and a match is only counted if the whole string is matched by the regex (i.e. an implicit surrounding ^$, as opposed to normal "regexes" which count a string as matching if any part of it matches the regex)

As such I've deleted my PCRE answer which, while it should work even in PHP, is almost definitely unintended in this case.

I forgot to say that the site checks the if the expression is valid by PHP's ereg function. It was said in discussion in http://www.ohjelmointiputka.net/keskustelu/18785-putkaposti-29-k%C3%A4%C3%A4nteislauseke/sivu-1

204 characters
(K((O(R(O(NKORO)*(NK(O(RK)?)?)?)?)?)?K)*(O(R(O(NKORO)*(N(K(O(RK?[^KO]|[^KR])|[^KO])|[^K])|[^KN])|[^KO])|[^KR])|[^KO])|[^K])*(K((O(R(O(NKORO)*(NK(O(RK)?)?)?)?)?)?K)*(O(R(O(NKORO)*(N(K(O(RK?)?)?)?)?)?)?)?)?

Generated by turning .*KORONKORKO.* into a finite state machine, inverting the finite state machine, and turning it back into a regex.

Why did this become the best answer?

Python, 77 79 97 118 bytes
Edit 3:  Rewrite. Uses nested lookaheads
^([^K]|K(?=$|[^O]|O(?=$|[^R]|R(?=$|[^O]|O(?=$|[^N]|N(?=$|[^K]|K(?=$|[^O]|O(?=$|[^R]|R(?=$|[^K]|K(?=$|[^O]))))))))))*$

Regex 101
Edit 2: Added '$|' throughout the regex. Now, if a prefix of KORONKORKO has been matched, the next item to match is end-of-string, a character that ends the prefix, or a character that extends the prefix if it is followed by something that ends the prefix.
This regex works with re.fullmatch(), which was added in Python 3.4.  To use with re.match(), ^ and $ need to be added to the beginning and end of the pattern, respectively, for 2 more bytes.
([^K]|K($|[^O]|O($|[^R]|R($|[^O]|O($|[^N]|N($|[^K]|K($|[^O]|O($|[^R]|R($|[^K]|K($|[^O]))))))))))*

Regex101 link
Previous incorrect solution (see comments):
K|([^K]|K([^O]|O([^R]|R([^O]|O([^N]|N([^K]|K([^O]|O([^R]|R([^K]|K[^O])))))))))*

Edit: Added single K

I don't believe this matches K.

@orip - Good catch.  Fixed.

Latest update now fails for KKORONKORKO

Is it fixable? Any ideas?

The starting ^ and ending $ aren't necessary. Also, = and $ aren't allowed.