text:
Explosions on a chessboard
Atomic chess is a (very fun)
variant of chess in which every capture causes an "explosion," destroying the
captured piece, the piece doing the capturing, and all non-pawns in a 1-square
radius. The goal of this challenge is not to play an entire game of atomic
chess, but simply to simulate what happens when a certain move is made.
Disclaimer: Explosion sound effects not included.
Input
Board position will be given in Forsyth-Edwards
Notation
(commonly known as FEN), but with only the first field. For example, an input
of:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR

represents the starting position:

This must be taken as a string or your language's equivalent. It is guaranteed
to be valid; for example, you don't have to care if there are ten kings, or if
there is no king at all.
You will also be given the move that you are to simulate, which is represented
as two square names: the square on which the piece to be moved is, and the
square it is moving to. For example, moving the king's pawn two spaces forwards
on the above picture would be represented as:
e2e4

This must also be taken as a string. The move will always be valid, and you do
not need to support castling. You do
need to support en passant, which
will be explained in further detail in the next section.
Output
The output of your program should be in the same partial-FEN notation as the
input, with the specified move made (and any pieces exploded if necessary).
The exact rules for explosions are—when a piece is captured:

Remove the piece being captured (this will always be the piece on the second
square named in the input, except for when the capture is an en passant).
Remove the piece that is doing the capturing (this will always be the piece
on the first square named in the input).
Remove every piece that is:

located on one of the 8 squares surrounding the one where the capture took
place (for en passant, this is the square that the capturing pawn would
be on, if it didn't explode).
not a pawn.

Quick overview of en passant rules, for those who are unfamiliar: if a pawn
moves two spaces forwards from its starting rank, and there is a pawn that
could have captured it if it only moved one square forward, it may capture it
anyway, but only on the subsequent move. This capture is said to be done "in
passing" (or in French: "en passant").
Test cases
In the pictures, the green arrows represet the move about to be made, and the
green circles represents pieces that are exploded.
Input: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR, g1f3
Output: rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R

Input: 3kBb1r/pp5p/3p4/4pn2/P7/1P2P1pP/2rP1P2/R1B3RK, f2g3
Output: 3kBb1r/pp5p/3p4/4pn2/P7/1P2P2P/2rP4/R1B3RK

(stolen from http://en.lichess.org/ocoSfS5I/white#36)

Input: rnbqk1nr/1pp5/p2pp1pp/5p2/1bN5/2P1PQ1N/PP1P1PPP/R1B1KB1R, f3b7
Output: 3qk1nr/2p5/p2pp1pp/5p2/1bN5/2P1P2N/PP1P1PPP/R1B1KB1R

(stolen from http://en.lichess.org/NCUnA6LV/white#14)

Input: rnbqk2r/pp2p2p/2p3pb/3pP3/5P2/2N5/PPPP2P1/R1BQKB1R, e5d6
Output: rnbqk2r/pp2p2p/2p3pb/8/5P2/2N5/PPPP2P1/R1BQKB1R

(stolen from http://en.lichess.org/AvgU4Skq/white#16; this wasn't the actual
move, but I couldn't be bothered to find an atomic game that actually had en
passant :P)

Input: 5r2/2k5/p1B5/1pP1p3/1P4P1/3P4/P7/1K3R1q, c6h1
Output: 5r2/2k5/p7/1pP1p3/1P4P1/3P4/P7/1K3R2

(stolen from http://en.lichess.org/l77efXEb/white#58)
Scoring
This is code-golf, so the shortest code in bytes wins.

So... taking a piece with your king is a bad idea?

@mbomb007 You are not allowed to take pieces with your king. :P

I might be mistaken, but how are we supposed to know if the en passant capture is possible? In your example the last move is denoted by the empty green square, so the black pawned can be captured en passant. But this information is not contained in the inputs we are given, so it is possible to have the exact same board but where the en passant capture is not possible, because the last move was not a two spaces forward move.

@Fatalize "The move will always be valid" - from the "Input" section.

Complete program or function?

@edc65 http://meta.codegolf.stackexchange.com/a/2422/3808

As I submitted a function, happy to use the default. Asking because you explicitly said "your program..."

+1 for "Explosion sound effects not included"

JavaScript (ES6) 305 310 321
As a function with 2 real parameters (and a lot more with default values, used as a quick and dirty way to define locals)
Test running the snippet below (being EcmaScript 6, Firefox only)

F=(g,m,b=[...g.replace(/\d/g,c=>'0'.repeat(c))],P=p=>p=='p'|p=='P',n=parseInt(m,32),
  s=n>>5&31,u=n>>15,x=b[y=u+62-(n>>10&31)*9])=>(
  b[b[y]=0,z=s+62-(n&31)*9]<1&!(s!=u&P(x))?b[z]=x:
  [-1,1,8,9,10,-8,-9,-10].map(i=>b[i+=z]>'/'&&!P(b[i])?b[i]=0:0,b[b[z]<1?z>y?z-9:z+9:z]=0),
  b.join('').replace(/0+/g,x=>x.length)
)

//TEST
out=x=>O.innerHTML+=x+'\n'

test=[
 ['rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR', 'g1f3'
  ,'rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R']
,['3kBb1r/pp5p/3p4/4pn2/P7/1P2P1pP/2rP1P2/R1B3RK', 'f2g3'
  ,'3kBb1r/pp5p/3p4/4pn2/P7/1P2P2P/2rP4/R1B3RK']
,['rnbqk1nr/1pp5/p2pp1pp/5p2/1bN5/2P1PQ1N/PP1P1PPP/R1B1KB1R', 'f3b7'
  ,'3qk1nr/2p5/p2pp1pp/5p2/1bN5/2P1P2N/PP1P1PPP/R1B1KB1R']
,['rnbqk2r/pp2p2p/2p3pb/3pP3/5P2/2N5/PPPP2P1/R1BQKB1R', 'e5d6'
  ,'rnbqk2r/pp2p2p/2p3pb/8/5P2/2N5/PPPP2P1/R1BQKB1R']
,['5r2/2k5/p1B5/1pP1p3/1P4P1/3P4/P7/1K3R1q', 'c6h1'
  ,'5r2/2k5/p7/1pP1p3/1P4P1/3P4/P7/1K3R2']
]

test.forEach(t=>(
  r=F(t[0],t[1]),
  out('Test '+(r==t[2]?'Ok':'Fail!')+'  '+t[0]+' move '+t[1]
     +'\nResult   '+r+'\nExpected '+t[2]+'\n')))

Ungolfed
B=(b,m)=>{
  P=p=>p=='p'|p=='P'
  m=parseInt(m,32)
  r=m&31 // arrival row
  s=(m/32&31)-10 // arrival column
  z=s+(8-r)*9 // arrival position
  t=m/32/32&31 // start row
  u=(m/32/32/32&31)-10 // start column
  y=u+(8-t)*9 // start position
  b=[...b.replace(/\d/g,c=>'0'.repeat(c))] // board to array, empty squares as 0
  x=b[y] // moving piece
  b[y]=0
  C=s!=u&P(x) // pawn capture
  if (b[z]<1 && !C)
  {  // no capture
    b[z]=x
  }
  else
  {
    // capture and boom!
    if (b[z]<1) // arrival empty: en passant
      b[z>y?z-9:z+9]=0;
    else
      b[z]=0;
    // zero to nearest 8 squares
    [-1,1,8,9,10,-8,-9,-10].forEach(i=>b[i+=z]>'/'&&!P(b[i])?b[i]=0:0)
  }
  return b.join('').replace(/0+/g,x=>x.length)
}

Wow, that looks a lot simpler than my solution... Nice job!

APL (Dyalog Extended), 240 bytes
e←' '@(p/⍨~(x←∊∘'Pp')(b←↑⊃¨,/¨{⍵∊⎕D:' '/⍨⍎⍵⋄⍵}¨¨'/'(≠⊆⊢)⎕)[p←p/⍨{∧/⍵∊⍳8}¨p←(⊃⌽c←{(9-⍎⊃⌽⍵),⎕A⍳⊃⍵}¨↓2 2⍴1⎕C⎕)∘+¨,∘.,⍨2-⍳3])
1↓⊃,/{'/',⊃,/{' '∊⍵:⍕≢⍵⋄⍵}¨⍵⊂⍨1,2≠/⍵}¨↓{(x⊃n)∧(≠/⊃¨⌽¨c)∧' '=⊃⌽n←b[c]:e' '@((⊃c)+0,1↓⊃-⍨/c)⊢b⋄' '∊n:(⌽n)@c⊢b⋄e' '@c⊢b}0

Try it online!
A full program which takes the FEN first, and the move second.
Explanation
First Line: Explode. Function
e←' '@(p/⍨~(x←∊∘'Pp')(b←↑⊃¨,/¨{⍵∊⎕D:' '/⍨⍎⍵⋄⍵}¨¨'/'(≠⊆⊢)⎕)[p←p/⍨{∧/⍵∊⍳8}¨p←(⊃⌽c←{(9-⍎⊃⌽⍵),⎕A⍳⊃⍵}¨↓2 2⍴1⎕C⎕)∘+¨,∘.,⍨2-⍳3])

1⎕C⎕ capitalize the first input
↓2 2⍴ cut into halves
{(9-⍎⊃⌽⍵),⎕A⍳⊃⍵}¨ apply the following to each square name:
         ,⎕A⍳⊃⍵ get position of first char in the alphabet(column)
(9-⍎⊃⌽⍵)        get 9-int(second char) (row number)
c← store that in c
⊃⌽ take the last element
∘+¨ and add that to:
,∘.,⍨2-⍳3 the cartesian product of (-1,0,1), getting the von neumann neighborhood
p← assign the explosion indices to p
p←p/⍨{∧/⍵∊⍳8}¨ remove the ones outside the board, and reassign to p
(...)[...] and index into the following:
'/'(≠⊆⊢)⎕ split the second input on slashes
⊃¨,/¨{⍵∊⎕D:' '/⍨⍎⍵⋄⍵}¨¨ convert each digit to the appropriate amount of spaces
b←↑ and convert it to a matrix, storing in b. This is the chess board.
x←∊∘'Pp' store function to check for pawns in x
p/⍨~(x←∊∘'Pp') now, remove the points which map to pawns
' '@ and insert a space at those indices in the right argument.
Second line: capture calculator
1↓⊃,/{'/',⊃,/{' '∊⍵:⍕≢⍵⋄⍵}¨⍵⊂⍨1,2≠/⍵}¨↓{(x⊃n)∧(≠/⊃¨⌽¨c)∧' '=⊃⌽n←b[c]:e' '@((⊃c)+0,1↓⊃-⍨/c)⊢b⋄' '∊n:(⌽n)@c⊢b⋄e' '@c⊢b}0

n←b[c] assign the starting and ending characters to n
' '=⊃⌽n←b[c] If ending square is empty,
(≠/⊃¨⌽¨c)∧ start column and end column are not equal,
(x⊃n)∧ and capturing piece is a pawn(en passant):
0,1↓⊃-⍨/c get the direction of capture
(⊃c)+ add that to the start index
' '@((⊃c)+0,1↓⊃-⍨/c)⊢b insert a space at that point
e and explode.
' '∊n else, if ending point is a space(no capture):
(⌽n)@c⊢b⋄ switch the places of the space and the piece
' '@c⊢b Otherwise, insert a space at the start and end index(normal capture)
e and explode.
¨↓ then, take each row,
⍵⊂⍨1,2≠/⍵ group it into equal runs
{' '∊⍵:⍕≢⍵⋄⍵}¨ replace runs of spaces with their length.
'/',⊃,/ join everything together and prepend a /
1↓⊃,/ join the rows together and drop the first /.

Java, (946 777 776 chars)
1 char thanks to @edc65
Note: Chars counted without test cases put in.
Code
class E{public static void main(String[]a){String i=a[0];char[]n=a[1].toCharArray();int j,k,z,w,y,u=56-n[3];char q,p,e ='e';char[][]b=new char[8][8];String[]r=i.split("/");for(j=0;j<8;j++){z=0;for(k=0;k<r[j].length();k++){p=r[j].charAt(k);if(Character.isDigit(p)){for(int l=k+z;l<k+z+p-48;l++)b[j][l]=e;z+=p-49;}else b[j][k+z]=p;}}z=n[0]-97;w=56-n[1];y=n[2]-97;p=b[w][z];q=b[u][y];b[w][z]=e;if(q!=e||((p|32)=='p'&&(w-u<0?u-w:w-u)==1&&(z-y<0?y-z:z-y)==1)){if(q!=e)b[u][y]=e;else b[w][y]=e;for(j=y-(y==0?0:1);j<y+(y==8?0:y==7?1:2);j++){for(k=u-(u==0?0:1);k<u+(u==8?0:u==7?1:2);k++)if((b[k][j]|32)!='p')b[k][j]=e;}}else b[u][y]=p;i="";for(j=0;j<8;j++){z=0;for(k=0;k<8;k++){if(b[j][k]==e)z++;else {if(z>0){i+=z;z=0;}i+=b[j][k];}}if(z>0)i+=z;i+=j!=7?"/":"";}System.out.print(i);}}

I'm not sure if this solution is optimal, but I'm working on golfing it more, any suggestions are welcome. I can comment all the code too if anyone would like, but I think it's mostly self explanatory, except for the confusing variable enumeration.
Explanation

Unpack the board string into a char matrix
Calculate the effect of the move
Repack the board into a string

Expanded
class ExplosionChess{
    public static void main(String[]a){
        String i=a[0];
        //"rnbqk1nr/1pp5/p2pp1pp/5p2/1bN5/2P1PQ1N/PP1P1PPP/R1B1KB1R";
        //"f3b7";
        char[]n=a[1].toCharArray();
        int j,k,z,w,y,u=56-n[3];
        char q,p,e ='e';
        char[][]b=new char[8][8];
        String[]r=i.split("/");
        for(j=0;j<8;j++){
            z=0;
            for(k=0;k<r[j].length();k++){
                p=r[j].charAt(k);
                if(Character.isDigit(p)){
                    for(int l=k+z;l<k+z+p-48;l++)
                        b[j][l]=e;
                    z+=p-49;
                }else
                    b[j][k+z]=p;
            }
        }
        z=n[0]-97;
        w=56-n[1];
        y=n[2]-97;
        p=b[w][z];
        q=b[u][y];
        b[w][z]=e;
        if(q!=e||((p|32)=='p'&&(w-u<0?u-w:w-u)==1&&(z-y<0?y-z:z-y)==1)){
            if(q!=e)
                b[u][y]=e;
            else
                b[w][y]=e;
            for(j=y-(y==0?0:1);j<y+(y==8?0:y==7?1:2);j++){
                for(k=u-(u==0?0:1);k<u+(u==8?0:u==7?1:2);k++)
                    if((b[k][j]|32)!='p')
                        b[k][j]=e;
            }
        }else
            b[u][y]=p;
        i="";
        for(j=0;j<8;j++){
            z=0;
            for(k=0;k<8;k++){
                if(b[j][k]==e)
                    z++;
                else {
                    if(z>0){
                        i+=z;
                        z=0;
                    }
                    i+=b[j][k];
                }
            }
            if(z>0)
                i+=z;
            i+=j!=7?"/":"";
        }
        System.out.print(i);
    }
}

Old
class E{public static void main(String[]a){String m,i="rnbqk1nr/1pp5/p2pp1pp/5p2/1bN5/2P1PQ1N/PP1P1PPP/R1B1KB1R";m="f3b7";char[]n=m.toCharArray();int z,w,y,u=56-n[3];z=n[0]-97;w=56-n[1];y=n[2]-97;char e='e';char[][]b=new char[8][8];String[]r=i.split("/");for(int j=0;j<8;j++){int o=0;for(int k=0;k<r[j].length();k++){char q=r[j].charAt(k);if(Character.isDigit(q)){for(int l=k+o;l<k+o+q-48;l++){b[j][l]=e;}o+=q-49;}else b[j][k+o]=q;}}char q,p=b[w][z];q=b[u][y];b[w][z]=e;if(q==e){if((p|32)=='p'&&(w-u<0?u-w:w-u)==1&&(z-y<0?y-z:z-y)==1){b[w][y]=e;for(int j=y-(y==0?0:1);j<y+(y==8?0:y==7?1:2);j++){for(int k=u-(u==0?0:1);k<u+(u==8?0:u==7?1:2);k++){if((b[k][j]|32)!='p')b[k][j]=e;}}}else{b[u][y]=p;}}else{b[u][y]=e;for(int j=y-(y==0?0:1);j<y+(y==8?0:y==7?1:2);j++){for(int k=u-(u==0?0:1);k<u+(u==8?0:u==7?1:2);k++){if((b[k][j]|32)!='p')b[k][j]=e;}}}i="";for(int j=0;j<8;j++){int x=0;for(int k=0;k<8;k++){if(b[j][k]==e)x++;else{if(x>0){i+=x;x=0;}i+=b[j][k];}}if(x>0)i+=x;i+=j!=7?"/":"";}System.out.println(i);}}

String m,i="";m="";char[]n=m.toCharArray() --> String i=a[0];char[]n=a[1].toCharArray() is shorter and so you get the parameters from outside (as you should anyway)

Ahh, okay I'll change that, thanks!


text:
Analyzing Earthquakes
Background
The Random Domino Automaton is a toy model for earthquakes, inspired by cellular automata.
In this challenge, your task is to simulate a simplified version of this model, and collect data out of it.
The automaton is defined on an array A of k bits, representing a fault line on which earthquakes may occur.
The array wraps around at its borders.
The condition A[i] = 0 means that position i is relaxed, and A[i] = 1 means that it's excited, or contains stored energy.
At each time step, one position of the array is chosen uniformly at random.
If that position is relaxed, it becomes excited (potential energy is added to the system).
If that position is already excited, it triggers an earthquake, and the chosen position and all excited positions connected to it are relaxed again.
The number of excited positions that become relaxed is the magnitude of the earthquake.
Example
Consider the array
100101110111

of length 12.
If the random process chooses the second bit from the left, the array is updated to
110101110111
 ^

since the chosen bit (marked with ^) was 0.
If we next choose the fourth bit from the left, which is an isolated 1, an eartquake of magnitude 1 is triggered, and the bit is set to 0 again:
110001110111
   ^

Next, we might choose the second bit from the right, which triggers an earthquake of magnitude 5:
000001110000
          ^

Note that all 1s in the same "cluster" as the chosen one were part of the quake, and the array wraps around at the border.
The Task
You shall take as inputs two positive integers k and t, and your task is to simulate the random domino automaton for t time steps, starting from an initial length-k array of all 0s.
Your output shall be a list L of k integers, where L[i] (with 1-based indexing) contains the number of earthquakes of magnitude i that occurred during the simulation.
You are allowed to drop trailing zeroes from the output.
For the inputs k = 15 and t = 1000, some representative outputs are
[117, 97, 45, 26, 10, 5, 3, 1, 3, 0, 0, 0, 0, 0, 0]
[135, 91, 58, 21, 8, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0]
[142, 63, 51, 31, 17, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0]
[106, 75, 45, 30, 16, 8, 5, 2, 2, 0, 0, 0, 0, 0, 0]
[111, 96, 61, 22, 3, 8, 3, 2, 0, 0, 0, 1, 0, 0, 0]

Rules
Both full programs and functions are allowed.
The shortest byte count wins, and standard loopholes are disallowed.
Note that you are not required to simulate the automaton using any particular implementation, only the output matters.

Is it possible that you can add a caret ^ under the bit that changes? It might make it easier to visualize the example

@DeadChex Good idea, updated.

Pyth, 48 bytes
Km0QJsM.u?<+vM.sjkZ\1KQe=Z.>NOQ+PZ1vwKm/-VJtJhdQ

Got a little bit inspired by @Dennis's explanation. Had some similar thoughts yesterday, but didn't really follow them.
Try it online: Demonstration
Explanation:
      implicit: Q is the first input number
 m0Q  create a list with Q zeros
K     store the list in K

       .u                      vwK   apply the following expression eval(input) times,
                                     start with N = K:
                      .>NOQ            shift N by a random integer of [0, ..., Q-1]
                    =Z                 store the result in Z
     ?             e Z                 if the last digit == 1:
            jkZ                          convert Z to string
          .s   \1                        remove "1"s from the start and end
        vM                               convert to list of integers
       +         K                       add K (adds a bunch of zeros)
      <           Q                      correct size (take the first Q elements)
                                         implicitly update N with this result
                                       else:
                           PZ            all but last of Z
                          +  1           append 1
                                         implicitly update N with this result

   .u                                gives all the intermediate states
 sM                                  sum each list
J                                    store in J

m/-VJtJhdQ
m        Q   map each d in [0, 1, ..., Q-1] to:
  -VJtJ        vectorized minus between J and J[1:]
 /     hd      count d+1 in ^
             implicitly print

CJam, 57 55 bytes
{:K,K0a*@[{Kmrm<){_{_0#>W%K0e]}2*_)}1?+}*;]1fb2/::-fe=}

This is an anonymous function that pops k and t from the stack (k on top of t) and leaves the desired array in return.
Try it online in the CJam interpreter.
How it works
:K         e# Save the topmost integer (k) in K.
,          e# Push I := [0 ... K-1].
K0a*       e# Push J := [0 ... 0] (K elements).
@          e# Rotate the other integer (t) on top of the stack.
[{         e# Do t times:
  Kmr      e#   Pseudo-randomly select an integer between 0 and t-1.
  m<       e#   Rotate the array J than many units to the left.
  )        e#   Pop out the last element.
  {        e#   If it is 1:
    _      e#     Copy J.
    {      e#     Do 2 times:
      _0#  e#       Push the first index of 0 in J.
      >    e#       Discard the preceding elements.
      W%   e#       Reverse the array.
      K0e] e#       Pad it with zeroes to length K.
    }2*    e#
    _)     e#     Copy J and pop out the last element.
  }        e#
  1?       e#   Else: Push 1.
  +        e#   Push the integer on the stack on J.
}*         e#
;          e# Discard the last value of J.
]          e# Collect the intermediate values of J in an array.
1fb        e# Replace each array by the sum of its elements (number of ones).
2/         e# Split the array into chunks of length 2.
::-        e# Replace each chunk by the difference of its elements.
fe=        e# Count the occurrences of each integer in I.

Python 2, 174 170
from random import*
k,t=input()
D=[0]*k
E=D+[0]
def U(x):b=D[x];D[x]=0;return b and-~U(x-1)+U(-~x%k)
for x in[0]*t:r=randint(0,k-1);e=U(r);E[e-1]+=1;D[r]=e<1
print E[:-1]

Thanks @Vioz for finding a shorter way to make D, and proving again that not is usually golfable. And also for writing the explanation.
I had tried to make a similar program in Pyth, but there seems to be a scope issue in what I was trying to do. This pretty naively implements the dominoes and the function U propagates earthquakes. The subtraction direction in U doesn't need a mod because it will wrap around naturally. The last element of E counts the number of times a zero is turned into a one, so it is not printed at the end.
Ungolfed + Explanation:
from random import*
k,t=input()                            # Takes input in form k,t
D = [0]*k                              # Empty array of size k is made for
                                       # performing the simulation.
E = D+[0]                              # Empty array of size k+1 is made for
                                       # storing the magnitudes.
def U(x):                              # Define a function U that takes an int x
    b = D[x]                           # Assign b to the value at x in D
    D[x] = 0                           # Clear the value at x in D
    return b and U(x-1)+1 + U((x+1)%k) # Return the sum of U(x-1)+1 and U((x+1)%k)
                                       # if b is a 1.
for x in[0]*t:                         # Perform t tests
    r=randint(0,k-1)                   # Generate a random number between 0 and k-1
    e=U(r)                             # Assign e to the value of U(r)
    E[e-1]+=1;                         # Increment the magnitude array at position
                                       # e-1
    D[r] = e<1                         # Set D[r] to be 1 if no earthquake happened.
print E[:-1]                           # Print the magnitude list

Changing D[r]=not e to D[r]=e<1 saves 2 bytes, and E=[0]*-~k to E=D+[0] saves another 2, to get you down to 170.

Java, 278 272 bytes
Java isn't the best Golf language, and I'm not the best golfer, but it was a lot of fun to write so here it is! Let me know about bugs and improvements! (I decided to resubmit as just a function.)
void e(int k, int t){int[]d=new int[k],b=d.clone();for(;t-->0;){int m=0,q=(int)(Math.random()*k),i=q,h=1,f=0;d[q]++;if(d[q]>1){for(;;){if(i<0){i=k-1;h=-1;}if(d[i%k]>0){m++;d[i%k]=0;}else{if(f>0)break;h*=-1;i=q;f=1;}i+=h;}b[m-1]++;}}System.out.println(Arrays.toString(b));}

And the file with spaces and comments:
void e(int k, int t){
    int[]d=new int[k],b=d.clone();          //b is the record, d is the map

    for(;t-->0;){                           //do time steps //q is the spot
      int m=0,q=(int)(Math.random()*k),i=q,h=1,f=0;
                        //m-magnitude,i spot examining, h moving index, f change counter
      d[q]++;                               //add the energy
      if(d[q]>1){                           //double energy, quake here
        for(;;){                            //shorthand while true
          if(i<0){                          //i has wrapped negative, need to start a left hand search from the end now
            i=k-1;                          //Start at the end
            h=-1;                           //Left handed search
          }
          if(d[i%k]>0){                     //is the spot energetic and set off
           m++;                             //add one to the mag counter
           d[i%k]=0;                        //remove energy
          } else {                          //it's a non active spot so we need to flip search direction
           if(f>0) break;                   //we've already flipped once, break
           h*=-1;                           //flip the direction now
           i=q;                             //reset the spot we look at to the epicenter
           f=1;                             //add one to the flip counter
          }
          i+=h;                             //add the search increment to the spot we look at
        }
        b[m-1]++;                           //update the mag record
      }
    }
    System.out.println(Arrays.toString(b)); //print it out
 }

If you could tab the comments out a bit in the 2nd program, that might help with readability. Thanks. (Use Alt+09, or tab it out in Notepad++)

d[q]+=1; this can become d[q]++; you can increment directly on arrays instead of using += everywhere. That should save a bunch of characters.

@Compass Already made that change, thanks though!

Also: for(;t>0;t--){  can be changed to for(;t-->0;){ :D

Congrats on your first golf here! :D  Now.... by just rearranging the declarations a bit and returning (instead of printing) the result, you can get this down quite a bit. There might be more to be done, but I have to go. Here's a 244 byte version: http://pastebin.com/TWAXvyHW

Python 2, 153 bytes
from random import*
k,t=input()
E=[0]*k
L=E+[0]
def g(i,x=0):y=E[i];E[i]=y&x^x;return y and-~g(i-1)+g(-~i%k)
exec"L[g(randrange(k),1)]+=1;"*t
print L[1:]

Turns out I had almost the same solution as Fry's, but with a bit more bit fiddling.

Wow I had actually looked at randrange, but I didn't realize it worked with only one argument. Nice work!

ES6, 224 196 189 179 172
The easy stuff has been golfed, but still some work to do. I'll type out an explanation later. Also, if someone can tell me why the short new Date%k thing doesn't work so well anymore, that'd be swell.
f=(k,t)=>{a=Array(k).fill(0);o=a.slice(0);for(;t--;){c=0;r=Math.random()*k|0;if(a[r]){for(d=r+1;d<k&a[d];c++)a[d++]--;for(d=r-1;d&a[d];c++)a[d--]--;o[c]++};a[r]^=1}return o}

Usage is
f(10, 1000);

You can remove the new . You don't need that t in the for loop, No need of that last two ;

@Optimizer you are hero to cause

a[r]^=1 will defs work if initial value is either 1 or 0

Perl, 212
The previous version I had put up was not correctly wrapping, and implementing that took some work.
sub f{sub n{$i=($i+$d)%($#a+1)}($k,$t)=@_;@L=@a=(0)x$k;for(1..$t){$i=$x=int rand($k);if(++$a[$x]>1){$d=1;my%z;for(;;){$z{$i}=1;n;if(!$a[$i]){$d*=-1;n}last if($d>0&&$i==$x)}@z=keys %z;@a[@z]=(0)x@z;++$L[$#z]}}@L}

This is probably not the right algorithm for this, but I can't think right now. The ungolfed version is below.
Ungolfed:
sub f {
  # n() implements the iterator, so that each time it is called a
  # global index is incremented or decremented correctly wrapping
  # around
  sub n { $i = ($i + $d) % ($#a + 1) }
  # Receive input
  ($k, $t) = @_;
  # Initialise the array for earthquake magnitudes an the fault
  # line
  @L = @a = (0) x $k;

  for(1..$t){
    # Assign a random integer value to two control variables
    # $i is used for moving along the fault, and $x to remember
    # the initial value
    $i = $x = int rand($k);
    # The corresponding value in the fault line is incremented,
    # and earthquakes detected
    if(++$a[$x]>1){
      # Earthquake!
      # To propagate the earthquake, we move along the fault
      # bouncing on unactivated nodes. We stop when we've covered
      # the entire activated block.

      # $d tracks the direction (initially forward);
      $d = 1;
      # %z keeps the indeces of known activated nodes
      my %z;

      for(;;){
        $z{$i} = 1;              # Read current node
        n;                       # Move head
        if (!$a[$i]) {           # If next one is deactivated
          $d *= -1;              # change direction
          n                      # and move the head (bounce!)
        }
        # If we've reached the beginning, and we're moving
        # forward we've covered the entire activated block
        last if ($d > 0 && $i == $x);
      }

      # Deactivate all consecutive activated nodes
      @z = keys %z;
      @a[@z] = (0) x @z;
      # And store the magnitude of the earthquake
      ++$L[$#z];
    }
  }
  # Return list of magnitudes
  @L
}

print join ' ', f(15, 1000), "\n";

CJam, 76 bytes
l~_0a*:R@{1$mr_2$={W@@[W1]{{_@0t@)\@K+_2$=}g2$+)}fK;\(_R=)R\t:R;}{1t}?}*;;Rp

Well, this is not very competitive. But since it took me long enough, I thought I'd post it anyway.
l~     Get input.
_0a*   Initial bit pattern, list of k zeros.
:R     Save away the list of zeros, will be used for histogram.
@{     Pull number of tries to top of stack, and start main loop.
1$mr   Generate random position in range 0 to k-1.
_2$    Duplicate current pattern and position.
=      Get current value of bit at position.
{      Start if statement. This is the block for bit value 1.
W@@    Create initial count of 1 bits in quake, and push it down the stack.
[W1]{  Start for loop over value [-1 1], the two increments for going left/right.
{      Start while loop that proceeds as long as 1 bits are found.
_@0t   Set current value of bit to 0.
@)     Get current bit counter to top of stack, and increment it.
\@     Pull list and bit position back to top of stack.
K+     Increment/decrement bit position.
_2$=   Get value at new bit position.
}g     End of while loop over 1 bits.
2$+)   Restore position to get ready to move in opposite direction.
}fK    End for loop over left/right increment.
;\(_   Pull counter of 1 bits in quake to top of stack.
R=     Get current value in histogram,
)      increment it,
R\t:R  and store it back in the histogram.
;}     End of if branch for 1 bit.
{1t}?  Else branch of if. For 0 bit, simply set it.
}*     End main loop.
;;Rp   Clean up stack and print histogram.

Try it online

source: Stack Exchange

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

sort: votes


text:
More is less and less is more
Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite.
Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria:

Your code must be at least 1 character long.
Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ≤ x < +∞.
Removing any arbitrary single character from the original code results again in valid code, which produces at least x + 1 characters of output to STDOUT.
Neither the original code nor the modifications may produce any error output, be to STDOUT, STDERR, syslog or elsewhere. The only exceptions to this rule are compiler warnings.
Your program may not require any flags or settings to suppress the error output.
Your program may not contain any fatal errors, even if they don't produce any output.
Both the original code and the modifications must be deterministic and finish eventually (no infinite loops).
Neither the original code nor the modifications may require input of any kind.
Functions or snippets may not maintain any state between executions.

Considering that this task is trivial is some languages and downright impossible in others, this is a popularity-contest.
When voting, please take the "relative shortness" of the code into account, i.e., a shorter answer should be considered more creative than a longer answer in the same language.

While the 1 byte solution is impressive, it would be more impressive to see who can come up with the highest ratio of x:x+n. i.e. the length of normal output compared to the average length of output when any one character is removed. Adds an extra challenge to this question in my opinion.

@FizzBuzz Easy: 111111111111111111^111111111111111111 (if you meant the lowest ratio).

Aw, just noticed 'no infinite loops.' I was working on creating a ><> program that would create output faster if an one character was removed, such that after a constant k instructions, the output of each program is strictly greater than the output of the original from then on (because the other programs would loop faster or output more each loop). It was looking pretty interesting. Maybe I'll see if I can finish it anyway, and make another challenge.

An interesting scoring metric for this challenge could be "most unique characters, ties go to shortest length". We would then try to get all the characters in a string literal though.

What is meant by an inner function?

Any REPL with caret XOR operation, 5 bytes
11^11

11^11 is of course 0. The only other possibilities are 1^11 or 11^1 which are 10, or 1111 which produces itself.

Well played, feersum. Well played.

Minus would also do the trick.

Similarly, 99|99

@Challenger5 -10 is longer than 0.

@MartinEnder Oh, I see. For some reason I thought it had to be a larger number.

TI-BASIC, 3 1
"

When the last line of a program is an expression, the calculator will display that expression. Otherwise, the calculator displays Done when the program finishes. The expression here is the empty string, but it could also work with any one-digit number.
2 bytes:
isClockOn

Same as the above but with a 2-byte token.
3 bytes:
ππ⁻¹

Prints 1 due to implied multiplication. Can be extended indefinitely by adding pairs of ⁻¹'s. The below also work.
√(25
e^(πi
⁻ii
ii³
2ππ
cos(2π

Longer solutions:
11/77►Frac
ᴇ⁻⁻44
cos(208341   //numerator of a convergent to pi; prints "-1"

There are probably also multi-line solutions but I can't find any.

I'm not familar with TI BASIC. Are you counting the sqrt and parenthesis as a single character?

Yes, the sqrt and parenthesis are together a single token, stored as one byte in the calculator's memory and entered with one keypress.

finally a way to stop that annoying Done message!

There is no Done token; the calculator displays Done when finished executing any program without an expression on the last line (including the empty program).

CJam, JavaScript, Python, etc, 18 bytes
8.8888888888888888

The outputs in CJam are:
8.8888888888888888 -> 8.88888888888889
8.888888888888888  -> 8.888888888888888
88888888888888888  -> 88888888888888888
.8888888888888888  -> 0.8888888888888888

JavaScript and Python work in similar ways. It isn't competitive in JavaScript and Python, but it's not easy to find a shorter one in CJam.

Nice floating-point abuse!

Octave, 5 bytes
10:10

(x : y) gives the array of numbers between x and y in increments of 1, so between 10 and 10 the only element is 10:
> 10:10
ans = 10

When the second argument is less than the first, octave prints the empty matrix and its dimensions:
> 10:1
ans = [](1x0)

> 10:0
ans = [](1x0)

When a character is removed from the first number, there are more elements in the array:
> 1:10
ans = 1 2 3 4 5 6 7 8 9 10

> 0:10
ans = 0 1 2 3 4 5 6 7 8 9 10

When the colon is removed, the number returns itself:
> 1010
ans = 1010

also valid in R

Microscript, 1 byte
h

This produces no ouput, as h suppresses the language's implicit printing. Removing the sole character produces a program whose output is 0\n.
I'll try to come up with a better answer later.
EDIT ON NOVEMBER 17:
This also works in Microscript II, with the exception that, instead of yielding 0\n, the empty program yields null.

Pyth, 3 bytes
cGG

G is preinitialized  with the lowercase letters in the alphabet. c is the split-function.
cGG splits the alphabet by occurrences of the alphabet, which ends in ['', ''] (8 bytes).
When the second parameter is missing, c splits the string by whitespaces, tabs or newlines. Since none of them appear in G, the output for cG is ['abcdefghijklmnopqrstuvwxyz'] (30 bytes).
And GG simply prints twice the alphabet on two seperate lines: abcdefghijklmnopqrstuvwxyz\nabcdefghijklmnopqrstuvwxyz (53 bytes).
Try it online: Demonstration

Python REPL, 6 bytes
Not the shortest, but here's another floating point abuse answer:
>>> 1e308
1e+308
>>> 11308
11308
>>> 11e08
1100000000.0
>>> 11e38
1.1e+39
>>> 11e30
1.1e+31

But...
>>> 11e308
inf

JavaScript (and a lot more), 5byte
44/44 or
44/44 -> 1
44/4  -> 11
4444  -> 4444
4/44  -> 0.09090909090909091

CJam, 5
''''=

Try it online
''''=   compares two apostrophes and prints 1
'''=    prints '=
''''    prints ''

Lenguage, 5 bytes
00000

The length of the program is 5 which corresponds to the brainf*** program , reading an end of input character and terminating without output.
Removing any char results in the code 0000 which has a length of 4 corresponding to the brainf*** program . printing out one character (codepoint 0) and terminating.
The Unary equivalent would be 0000000000000 (13 zeros) because you have to prepend a leading 1 to the binary length of the code so 101 becomes 1101.

PHP, 6 bytes
I have been watching this group for a couple of weeks and am amazed of your programming techniques. Now I had to sign in, there is something I can do, sorry :-) However, this might be my last post here...
<?php

(note the space after second p)
This outputs empty string. Removing any character outputs the text without the character. Note it can produce HTML errors (content not rendered by browsers for eg. <?ph).
I also tried with the echo tag. ie. eg.:
<?= __LINE__;;

This one outputs 1. If = is omitted, <? __LINE__;; is the output. However, removing any of the magic constant character will result in E_NOTICE: Notice: Use of undefined constant LNE - assumed 'LNE' in...
If notices are not considered errors (point 4 of rules), this also applies :-)

Oh, that's clever. I guess a linefeed would work as well. If the task was to produce HTML, this would be invalid. However, PHP can be run from the command line, just like any other programming language, where the output is simply printed to the screen.

@Dennis PHP outputs anything. You can always use CTRL-U in your browser to see the output. HTML might be invalid, but in fact the program is not (there is no <HTML> tag etc.)

My point is that there's no need to involve a browser at all. Just execute php test.php. The second code is invalid by the way. The question does not forbid errors but error output, meaning errors, warning, notices, etc.

#! in a script file also works.

Python, 10 8 bytes
256**.25

Works in Python and friends.
Thanks to Jakube for showing how to make it 2 bytes smaller.
From IDLE:
>>> 256**.25
4.0
>>> 26**.25
2.2581008643532257
>>> 56**.25
2.7355647997347607
>>> 25**.25
2.23606797749979
>>> 256*.25
64.0
>>> 256*.25
64.0
>>> 256**25
1606938044258990275541962092341162602522202993782792835301376L
>>> 256**.5
16.0
>>> 256**.2
3.0314331330207964

originally I had this (10 bytes):
14641**.25

From IDLE:
>>> 14641**.25
11.0
>>> 4641**.25
8.253780062553423
>>> 1641**.25
6.364688382085818
>>> 1441**.25
6.161209766937384
>>> 1461**.25
6.18247763499657
>>> 1464**.25
6.185648950548194
>>> 14641*.25
3660.25
>>> 14641*.25
3660.25
>>> 14641**25
137806123398222701841183371720896367762643312000384664331464775521549852095523076769401159497458526446001L
>>> 14641**.5
121.0
>>> 14641**.2
6.809483127522302

and on the same note:
121**.25*121**.25

works identically due to nice rounding by Python, in 17 bytes.
>>> 121**.25*121**.25
11.0
>>> 21**.25*121**.25
7.099882579628641
>>> 11**.25*121**.25
6.0401053545372365
>>> 12**.25*121**.25
6.172934291446435
>>> 121*.25*121**.25
100.32789990825084
>>> 121*.25*121**.25
100.32789990825084
>>> 121**25*121**.25
3.8934141282176105e+52
>>> 121**.5*121**.25
36.4828726939094
>>> 121**.2*121**.25
8.654727864164496
>>> 121**.25121**.25
29.821567222277217
>>> 121**.25*21**.25
7.099882579628641
>>> 121**.25*11**.25
6.0401053545372365
>>> 121**.25*12**.25
6.172934291446435
>>> 121**.25*121*.25
100.32789990825084
>>> 121**.25*121*.25
100.32789990825084
>>> 121**.25*121**25
3.8934141282176105e+52
>>> 121**.25*121**.5
36.4828726939094
>>> 121**.25*121**.2
8.654727864164496

@Akiino I do not understand the edit you made. The line you removed was one of the required possibilities and no different then any of the ones below it. Could you explain why you removed it? I rolled it back, but can concede to undo the action with adequate reasoning.

My inner perfectionist just couldn't sleep well knowing that the line (the one that i removed) is duplicated for no reason. There are lines 56..., 26... and then 56... again, but there is only one way to get 56, so it should be included only once, isn't it?

Oh, I didn't see that it was on there twice. My bad, good catch.

I rolled back my rollback.

SWI-Prolog interpreter
__A=__A.

Note: You cannot remove the final .. Prolog interpreters will always look for a final period to run your query, so if we stick strictly to the rules of this contest and allow ourselves to remove the period it won't run, it will jump a line and wait for additional commands until one is ended by a period.
The original query __A=__A. outputs true..
The query _A=__A. outputs _A = '$VAR'('__A'). Similar modifications (i.e. removing one _ or one of the two A) will result in similar outputs.
Finally, the query __A__A. outputs in SWI-Prolog:
% ... 1,000,000 ............ 10,000,000 years later
%
%       >> 42 << (last release gives the question)

@Jakube I don't see how having a mandatory final period is a lot different than having to input the enter key to run a snippet in another language. If you remove the linefeed it won't run either.

It is more equivalent to a semicolon in some languages, and that does count as a character.

K, 3 bytes
2!2

Outputs 0 in the REPL. Removing the first 2 outputs 0 1, removing the exclamation results in 22, and removing the last 2 results in a string that varies between K implementations but is always at least 2 characters (in oK, it's (2!); according to @Dennis, Kona outputs 2!).

@Sp3000 Removing the * just prints 2. Removing the 2 prints (*!) (an incomplete function) in oK; I don't know about other interpreters (e.g. Kona, k2, etc.), although I believe Kona would print *[!;] or something similar. I went with removing the star because it seemed the safest.

You can't choose, It must work removing any character

@edc65 Fixed at the expense of not a single byte.

@Dennis Updated.

Sed, 1 byte
d

As sed requires an input stream, I'll propose a convention that the program itself should be supplied as input.
$ sed -e 'd' <<<'d' | wc -c
0
$ sed -e '' <<<'d' | wc -c
2

An alternative program is x, but that only changes from 1 to 2 bytes of output when deleted.

I actually forgot to add a no input rule to the question, so you didn't violate any rules at the time of submission. I've created the discussion Are languages like sed exempt from “no input” rules? on Meta.

MATLAB, 9 7 bytes
It's 2 bytes longer than the other MATLAB/Octave answer, but I like it nonetheless, as it's a bit more complex.
Matlab's ' operator is the complex conjugated transpose. Using this on a scalar imaginary number, you get i' = -i. As imaginary  numbers can be written simply as 2i one can do:
2i--2i'
ans =
     0

Removing any one of the characters will result in one of the below:
ans =
   0.0000 - 1.0000i
   2.0000 - 2.0000i
   0.0000 + 4.0000i
   0.0000 + 4.0000i
   0.0000 + 1.0000i
   2.0000 + 2.0000i
   0.0000 + 4.0000i

GolfScript, 2 bytes
This answer is non-competing, but since it is the piece of code that inspired this challenge, I wanted to share it anyway.
:n

By default, all GolfScript programs print the entire stack, followed by a linefeed, by executing puts on the entire stack. The function puts itself is implemented as {print n print} in the interpreter, where print is an actual built-in and n is a variable that holds the string "\n" by default.
Now, a GolfScript program always pushes the input from STDIN on the stack. In this case, since there isn't any input, an empty string is pushed. The variable assignment :n saves that empty string in n, suppressing the implicit linefeed and making the output completely empty.
By eliminating n, you're left with the incomplete variable assignment : (you'd think that's a syntax error, but nope), so the implicit linefeed is printed as usual.
By eliminating :, you're left with n, which pushes a linefeed on the stack, so the program prints two linefeeds.

J, 5 bytes
|5j12

Magnitude of the complex number 5 + 12i in REPL.
   |5j12 NB. original, magnitude of the complex number `5 + 12i`
13
   5j12  NB. the complex number `5 + 12i`
5j12
   |j12  NB. magnitude of the undefined function j12
| j12
   |512  NB. magnitude of 512
512
   |5j2  NB. magnitude of 5 + 2i
5.38516
   |5j1  NB. magnitude of 5 + 1i
5.09902

.
J, 9 bytes
%0.333333

Based on floating point precision, reciprocal and matrix inverse.
   %0.333333 NB. original, reciprocal of 0.333333
3
   0.333333  NB. 0.333333
0.333333
   %.333333  NB. matrix inverse of 333333
3e_6
   %0333333  NB. reciprocal of 333333
3e_6
   %0.33333  NB. reciprocal of 0.33333
3.00003

Try it online here.

APL, J and possibly other variants, 3 bytes
--1

It outputs 1 in APL. -1 outputs ¯1, and -- outputs the following in TryAPL:
┌┴┐
- -

Mathematica, 3 bytes
4!0

4!0  ->  0    the factorial of 4, times 0
4!   ->  24   the factorial of 4
40   ->  40
!0   ->  !0   the logical not of 0, but 0 is not a boolean value

Dyalog APL, 2 bytes
⍴0 returns an empty string (length 0)
⍴ returns ⍴ (length 1)
0 returns 0 (length 1)

Swift (and a lot more), 8 bytes
93^99<84

output (4 chars):
true

When removing the nth character the output is:
n -> out
----------
0 -> false
1 -> false
2 -> false
3 -> false
4 -> false
5 -> 10077
6 -> false
7 -> false

There are 78 possible solutions like this in the format of a^b<c.
I think the goal of this challenge should be as many bytes as possible, because the more bytes, the more possible bytes to remove and therefore more difficult.

I thought about that, but it would have been to easy for stack-based languages. If this was a code bowling challenge, aditsu would have an infinte score. His code can be repeated over and over again; each copy will do exactly the same.

@Dennis Oh I see, yeah makes sense, but I think bytes are maybe not a very good measure for this task

I agree. That's why it's a popularity contest. Most upvoted answer wins.

MathGolf, 2 bytes
♂(

Try it online!
Explanation
♂   Push 10
 (  Decrement TOS by 1

Why does this work?
The regular output is 9. If the ( is removed, the output is 10. If the ♂ is removed, the program implicitly pops a 0 from the stack to feed the ( operator, which outputs -1.

05AB1E (legacy), 1 byte
Any single byte in 05AB1E (legacy) would work, except for [ (infinite loop).
See here all possible outputs for all possible single-byte 05AB1E programs.
Removing that single byte so an empty program remains will output the content of info.txt to STDOUT instead by default.
Try it online.

05AB1E, 1 byte
?

Try it online.
Unfortunately an empty program in the new version of 05AB1E only outputs a 1-byte newline by default (Try it online), so almost none of the 1-byte characters are possible since they'll have to output nothing. The only possible program that outputs nothing (so also not the implicit newline) is ? as far as I know.

Clojure, 11 bytes
(defn x[]1)

At first I thought to just post a single character answer in the REPL like the other languages, e.g.
user=> 1
1

But the problem is that if you remove that character, the REPL doesn't do anything upon the enter keypress. So instead it had to be wrapped with a function as permitted by the question's rules. When you call this function, it returns 1. If you remove the only character in the function,
(defn x[])

the function returns nil which prints an additional two bytes.
user=> (defn x[]1)
#'user/x
user=> (x)
1
user=> (defn y[])
#'user/y
user=> (y)
nil

To clarify: The contest requires an inner function, which would be 1 in this case (1 byte).

Japt, 2 bytes
AÉ

Try it online!
A is pre-initialized to 10, É subtracts 1, and the result is 1 byte: 9.
Removing É results in the program A, which outputs A's value, 10, so the result is 2 bytes.
Similarly, removing A results in just É which is interpreted as -1 and output as -1, so the result is 2 bytes.

Runic Enchantments, 6 (modifiable) bytes
11-{{B\
/B~~@/
\00<
R"Error"@

Try it online!
Runic does not have a REPL environment and writing a full program to satisfy the constraints is not readily feasible (leading to either invalid programs or no output). So the portion of the code 11-{{B is acting as an inner function and only this portion can be modified. The B instruction is close enough to a function pointer and return statement that this classification should be acceptable (as it jumps the IP to a position in the code as well as pushing a return location to the stack which may be accessed by a subsequent B or discarded).

Standard output: 0
Removing either of the 1s: 05
Removing the -: 11
Removing either {: Error051
Removing the B: 120

The final \ on the end of the first line provides an external boundary around the inner function in the event that the return instruction is removed so that the IP doesn't go meandering all over everywhere willy nilly (and print no output).
Note that Error051 is just an arbitrary string, I could put anything I wanted into that portion of the code and "Error" was an amusing result for having code that feks up the return coordinates and the IP teleports to an arbitrary location.

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

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


text:
Grid crossing sequence
If you take a sheet of graph paper and draw a sloped line that goes m units right and n units up, you cross n-1 horizontal and m-1 vertical gridlines in some sequence. Write code to output that sequence.
For example, m=5 and n=3 gives:

Possibly related: Generating Euclidian rhythms, Fibonacci tilings, FizzBuzz
Input: Two positive integers m,n that are relatively prime
Output: Return or print the crossings as a sequence of two distinct tokens. For example, it could be a string of H and V, a list of True and False, or 0's and 1's printed on separate lines. There can be a separator between tokens as long as it's always the same, and not, say, a variable number of spaces.
Test cases:
The first test case gives empty output or no output.
1 1
1 2 H
2 1 V
1 3 HH
3 2 VHV
3 5 HVHHVH
5 3 VHVVHV
10 3 VVVHVVVHVVV
4 11 HHVHHHVHHHVHH
19 17 VHVHVHVHVHVHVHVHVVHVHVHVHVHVHVHVHV
39 100 HHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHH

In the format (m,n,output_as_list_of_0s_and_1s):
(1, 1, [])
(1, 2, [0])
(2, 1, [1])
(1, 3, [0, 0])
(3, 2, [1, 0, 1])
(3, 5, [0, 1, 0, 0, 1, 0])
(5, 3, [1, 0, 1, 1, 0, 1])
(10, 3, [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1])
(4, 11, [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0])
(19, 17, [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
(39, 100, [0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0])

Today on PPCG: golf Bresenham's Line Drawing Algorithm

Based on the alternate format you added, can/must the input be repeated as part of the output? Otherwise, I don't understand why the input and output are part of the same list.

@RetoKoradi No, you shouldn't include the input. I put it in tuples to make it easier to process the test cases.

I can predict the answer, but it can't hurt to ask: Would it be acceptable to use the space character as one of the output tokens? A consequence would be that there could be significant leading/trailing spaces in the output. There would be no other spaces, so all spaces would be significant.

@RetoKoradi No, because trailing spaces aren't visible.

Ruby, 92; Ostrich 0.7.0, 38
f=->m,n{((1..m-1).map{|x|[x,1]}+(1..n-1).map{|x|[1.0*x*m/n,0]}).sort_by(&:first).map &:last}

:n;:m1-,{)o2W}%n1-,{)m n/*0pW}%+_H$_T%

Output for both of them uses 1's and 0's (ex. 101101).

Here's an explanation of the Ostrich one:
:n;:m    store n and m as variables, keep m on the stack
1-,      from ex. 5, generate [0 1 2 3]
{...}%   map...
  )        increment, now 5 -> [1 2 3 4]
  o        push 1 (the digit 1 is special-cased as `o')
  2W       wrap the top two stack elements into an array
           we now have [[1 1] [2 1] [3 1] [4 1]]
n1-,     doing the same thing with n
{...}%   map...
  )        increment, now 3 -> [1 2]
  m n/*    multiply by slope to get the x-value for a certain y-value
  0        push 0
  pW       wrap the top two stack elements (2 is special-cased as `p')
+        concatenate the two arrays
_H$      sort-by first element (head)
_T%      map to last element (tail)

And an explanation of how the whole thing works, using the Ruby code as a guide:
f = ->m,n {
    # general outline:
    # 1. collect a list of the x-coordinates of all the crossings
    # 2. sort this list by x-coordinate
    # 3. transform each coordinate into a 1 or 0 (V or H)
    # observation: there are (m-1) vertical crossings, and (n-1) horizontal
    #   crossings. the vertical ones lie on integer x-values, and the
    #   horizontal on integer y-values
    # collect array (1)
    (
        # horizontal
        (1..m-1).map{|x| [x, 1] } +
        # vertical
        (1..n-1).map{|x| [1.0 * x * m/n, 0] }  # multiply by slope to turn
                                               # y-value into x-value
    )
    .sort_by(&:first)  # sort by x-coordinate (2)
    .map &:last        # transform into 1's and 0's (3)
}

Python, 53
This uses the True/False list output. Nothing special here.
lambda m,n:[x%m<1for x in range(1,m*n)if x%m*(x%n)<1]

Pyth - 32 24 bytes
Jmm,chk@Qddt@Qd2eMS+hJeJ

Takes input via stdin with the format [m,n].
Prints the result to stdout as a list of 0's and 1's, where 0 = V and 1 = H.
Test it online

Explanation:
J                           # J =
 m             2            # map(lambda d: ..., range(2))
  m        t@Qd             # map(lambda k: ..., range(input[d] - 1))
   ,chk@Qdd                 # [(k + 1) / input[d], d]
                eMS+hJeJ    # print map(lambda x: x[-1], sorted(J[0] + J[-1])))

You can save a byte by using the syntactical map operator for the when you're mapping end. eM is the same as med.

Also, you can just take out @"VH" since you are allowed to print 0 and 1 instead of V and H.

You can save yet another byte by using inline assignment with J. Here is what I have so far at 25 bytes: https://pyth.herokuapp.com/?code=jkeMS%2BhJmm%2Cchk%40Qddt%40Qd2eJ&input=%5B39%2C100%5D&debug=1

@Maltysen, thanks I think you can remove jk as the output can be a list.

You can get 23 look at my comment about inline assignment.

@Maltysen Some nice tips, but try harder. ;-) 16 bytes using the exact same algorithm.

IA-32 machine code, 26 bytes
Hexdump of the code:
60 8b 7c 24 24 8d 34 11 33 c0 2b d1 74 08 73 03
03 d6 40 aa eb f2 61 c2 04 00

I started from the following C code:
void doit(int m, int n, uint8_t* out)
{
    int t = m;
    while (true)
    {
        if (t >= n)
        {
            t -= n;
            *out++ = 1;
        }
        else
        {
            t += m;
            *out++ = 0;
        }
        if (t == n)
            break;
    }
}

It writes the output into the supplied buffer. It doesn't return the length of the output, but it's not really needed: the output length is always m + n - 2:
int main()
{
    char out[100];
    int m = 10;
    int n = 3;
    doit(m, n, out);
    for (int i = 0; i < m + n - 2; ++i)
    {
        printf("%d ", out[i]);
    }
}

To convert the C code into machine code, I first did some tweaking, to make one of the if/else branches empty, and compare with 0 instead of n:
void doit(int m, int n, char* out)
{
    int t = n;
    while (true)
    {
        int r = 0;
        t -= m;
        if (t == 0)
            break;
        if (t >= 0)
        {
        }
        else
        {
            t += m + n;
            ++r;
        }
        *out++ = r;
    }
}

From here, writing the inline-assembly code is straightforward:
__declspec(naked) void __fastcall doit(int x, int y, char* out)
{
    _asm
    {
        pushad;                 // save all registers
        mov edi, [esp + 0x24];  // edi is the output address
        lea esi, [ecx + edx];   // esi is the sum m+n
    myloop:                     // edx is the working value (t)
        xor eax, eax;           // eax is the value to write (r)
        sub edx, ecx;
        jz myout;
        jae mywrite;
        add edx, esi;
        inc eax;
    mywrite:
        stosb;                  // write one value to the output
        jmp myloop;
    myout:
        popad;                  // restore all registers
        ret 4;                  // return (discarding 1 parameter on stack)
    }
}

I'm curious -- why does this algorithm work?

@xnor Informally, it tracks the fizzbuzz sequence. Here t is the "distance to buzz". If the distance is at least n, go fizz, else go buzz; update the distance; repeat until it's 0.

CJam, 15 bytes
Ll~_:*,\ff{%!^}

Try it here.
It prints 01 for V and 10 for H.
Explanation
L          e# An empty list.
l~         e# Evaluate the input.
_:*,       e# [0, m*n).
\          e# The input (m and n).
ff{%!      e# Test if each number in [0, m*n) is divisible by m and n.
^}         e# If divisible by m, add an 10, or if divisible by n, add an 01 into
           e# the previous list. If divisible by neither, the two 0s cancel out.
           e# It's just for output. So we don't care about what the previous list
           e# is -- as long as it contains neither 0 or 1.

The diagonal line crosses a horizontal line for every 1/n of the whole diagonal line, and crosses a vertical line for every 1/m.

Will you add an explanation for this? It's very intriguing, but at least from an initial quick look I don't understand why it works. From playing with it, I notice that it only works for values that are relative primes (which is given in the problem description), while mine works for all values. So the underlying math is obviously very different.

After letting it sink in some more, I believe I understand at least the algorithm part. Have to study the output generation logic later.

@RetoKoradi Edited.

Python - 125 bytes
Uses a very simple algorithm, just increments the coordinates and detects when it crosses the lines and prints out. Am looking to translate to Pyth.
a,b=input()
i=1e-4
x=y=l=o=p=0
k=""
while len(k)<a+b-2:x+=i*a;y+=i*b;k+="V"*int(x//1-o//1)+"H"*int(y//1-p//1);o,p=x,y
print k

That while loop is checking the number of lines and then checking if any of the values went over an int boundary by subtracting.
Takes input like 39, 100 from stdin and prints out like HHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHHHVHHVHHHVHHVHHHVHHVHHHVHH to stdout in one line.

TI-BASIC, 32
Prompt M,N
For(X,1,MN-1
gcd(X,MN
If log(Ans
Disp N=Ans
End

Straightforward. Uses a sequence of 0 and 1, separated by linebreaks. TI-BASIC's advantages are the two-byte gcd( and implied multiplication, but its disadvantages are the For loop including the end value and the 5 bytes spent for input.

Python, 47
lambda m,n:[m>i*n%(m+n)for i in range(1,m+n-1)]

Like anatolyg's algorithm, but checked directly with moduli.

05AB1E, 8 7 bytes
PLIδÖʒO

Inspired by @jimmy23013's CJam answer, so make sure to upvote him as well!
Input as a pair of integers \$[m,n]\$ and output as a list of [0,1] and [1,0] pairs for \$V\$ and \$H\$ respectively.
Try it online or verify all test cases.
Explanation:
P        # Take the product of the (implicit) input-pair: m*n
 L       # Pop and push a list in the range [1, m*n]
  IδÖ    # Check for each value in this list, whether each value in the input-pair evenly
         # divides it (resulting in [0,0] if the number is neither divisible by `m` nor `n`;
         # [0,1] if the number is only divisible by `m`;
         # [1,0] if the number is only divisible by `n`;
         # [1,1] for the final number m*n, which is divisible by both `m` and `n` obviously)
     ʒ   # Then filter this list of pairs, keeping only the pairs which are truthy for:
      O  #  Where the sum of the pair is exactly 1 (NOTE: only 1 is truthy in 05AB1E)
         # (after which the resulting list is output implicitly)

Haskell, 78 bytes
import Data.List
m#n=map snd$sort$[(x,0)|x<-[1..m-1]]++[(y*m/n,1)|y<-[1..n-1]]

Usage example:
*Main> 19 # 17
[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]
*Main> 10 # 3
[0,0,0,1,0,0,0,1,0,0,0]

How it works: make a list of the x-values of all vertical crossings (x,0) for x in [1,2,...,m-1] (0 indicates vertical) and append the list of the x-values of all horizontal crossings (y*m/n,1) for y in [1,2,...,n-1] (1 indicates horizontal). Sort and take the second elements of the pairs.
Curse of the day: again I have to spent 17 bytes on the import because sort is in Data.List and not in the standard library.

CJam, 26 24 bytes
l~:N;:M{TN+Mmd:T;0a*1}*>

Try it online
Very straightforward, pretty much a direct implementation of a Bresenham type algorithm.
Explanation:
l~    Get input and convert to 2 integers.
:N;   Store away N in variable, and pop from stack.
:M    Store away M in variable.
{     Loop M times.
  T     T is the pending remainder.
  N+    Add N to pending remainder.
  M     Push M.
  md    Calculate div and mod.
  :T;   Store away mod in T, and pop it from stack
  0a    Wrap 0 in array so that it is replicated by *, not multiplied.
  *     Emit div 0s...
  1     ... and a 1.
}*      End of loop over M.
>       Pop the last 1 and 0.

The last 01 needs to be popped because the loop went all the way to the end point, which is not part of he desired output. Note that we can not simply reduce the loop count by 1. Otherwise, for N > M, all the 0s from the last iteration will be missing, while we only need to get rid of the very last 0.

You can use > for ;W<.

@jimmy23013 Good idea. Since I know that I have a 1 on top of the stack, I might as well use it productively.

KDB(Q), 44 bytes
{"HV"0=mod[asc"f"$1_til[x],1_(x*til y)%y;1]}

Explanation
Find all x axis values of intersect points and sort them. If mod 1 is zero its "V", non-zero is "H".
Test
q){"HV"0=mod[asc"f"$1_til[x],1_(x*til y)%y;1]}[5;3]
"VHVVHV"


text:
Output the Iccanobif Sequence
Write a program or named function that will output or return the sequence up to the nth integer in the Iccanobif sequence, documented on OEIS as A014258. Note that only the zeroth element in the sequence (0) will be printed if n is zero.
The sequence is generated by starting like the standard Fibonacci sequence, but after adding the two previous numbers, you flip the result and drop any leading zeros. An interesting fact, to me at least, is that this sequence is not strictly increasing (see the list below). It also seems to be (and probably is) strictly greater than or equal to the Fibonacci sequence.
Your program's input must be an integer.
The first 20 numbers of the sequence are provided here for your viewing pleasure:
0, 1, 1, 2, 3, 5, 8, 31, 93, 421, 415, 638, 3501, 9314, 51821, 53116, 739401, 715297, 8964541, 8389769

Standard loopholes are forbidden.
Shortest program wins.
EDIT: Added a note to clarify that the sequence starts with the zeroth element and should be included if n is zero.
Example IO possibilities:
0    ->    0
1    ->    0 1
6    ->    0 1 1 2 3 5 8
17   ->    [0, 1, 1, 2, 3, 5, 8, 31, 93, 421, 415, 638, 3501, 9314, 51821, 53116, 739401, 715297]

Now that there are several answers, below are my implementations in Python 2 that I worked hard to hide with markup:
Iterative:

#Closest to my initial program. 73 bytes. It should also be noted that this program
 cannot reach a stack overflow. It runs for n=5000 in less than 10 seconds.

i,a,b=input(),0,1
print a
while i:print b;i,a,b=i-1,b,int(str(a+b)[::-1])

Recursive:

#Note that this prints n trailing newlines. 64 bytes.
 Will hit a stack overflow error for large values of n.

def f(n,i=0,j=1):print i,n and f(n-1,j,int(str(i+j)[::-1]))or'';

+1 for thinking of something to do with the Fibonacci sequence that hasn´t been done before

@steveverrill I decided I wanted to make another challenge, then started with just deciding to see what the sequence would look like, after I imagined it. So I wrote a program. Then I searched OEIS and made the challenge.

Was it inspired by this question?

@JohnE No. I've seen it before, but that challenge is one of the most simple challenges on this site. No, I was just creating a number sequence purely from my imagination that I could use as a challenge.

I think you should wait a little longer before accepting an answer. Unless one of the answers is clearly unbeatable (e.g., a 1 byte solution), it's advisable to wait at least a week.

@Dennis I was going to update which answer is accepted if it gets beaten, but I'll un-accept it. You'll probably have to remind me to accept an answer, unless PCG sends reminders.

@mbomb007 I usually accept an answer after a day or so, and update it when it's beaten. It's not a big deal either way.

@mbomb007 Why do you require a named function?

Idk. I wrote it in 2015. I'm not going to change it now.

Pyth, 17 15 14
Pu+Gs_`s>2GQU2

Try it online
Very basic implementation, starts with range(2) and adds a number of elements equal to the input, then slices off the extras pops off the last element.
Thanks @Jakube for pointing out the > reversal thingy.
Explanation
Pu+Gs_`s>2GQU2    : Q = eval(input) (implicit)
P                 : all but the last element
 u         QU2    : reduce Q times starting with [0, 1]
  +G              : add to the previous result
       s>2G       : sum of the last two elements of G
    s_`           : int(reversed(repr(above value)))

Python 2, 58 bytes
a=0;b=1
exec"print a;a,b=b,int(str(a+b)[::-1]);"*-~input()

Uses str to convert rather than backticks because large enough numbers in Python 2 are written with an L at the end. I tried a recursive function, but it turned out longer (61):
f=lambda n,a=0,b=1:-~n*[0]and[a]+f(n-1,b,int(str(a+b)[::-1]))

K, 25 23 bytes
{-1_ x{x,.|$+/-2#x}/!2}

A simple modification of one of the examples at No Stinking Loops.
The phrase .|$ casts a number to a string, reverses it and then evaluates it.
Edit:
Sloppy attention to boundary conditions on my part. More correct now:
  {-1_ x{x,.|$+/-2#x}/!2}'0 1 6 10
(,0
 0 1
 0 1 1 2 3 5 8
 0 1 1 2 3 5 8 31 93 421 415)

Edit 2:
(x+1)# can be replaced with -1_, saving 2 characters. The space is necessary because otherwise _x would be an identifier, when I want the "drop" operator applied to a variable called x.

According to the OP, the output should start with a zero.

Correct- Should be fixed now.

Came here to post an answer only to see you had the exact same one. Nicely done.

Julia, 79 bytes
f=n->(t=[0,1];for i=2:n push!(t,t[i]+t[i-1]|>string|>reverse|>int)end;t[1:n+1])

This creates a function that accepts an integer as input and returns an integer array.
Ungolfed + explanation:
function f(n)
    # Start with the usual Fibonacci stuff
    t = [0,1]

    # Looooooooooooooop
    for i = 2:n
        # Compute the Iccanobif number by piping results
        iccanobif = t[i] + t[i-1] |> string |> reverse |> int

        # Jam it into t
        push!(t, iccanobif)
    end

    # Return the first n + 1
    t[1:n+1]
end

Examples:
julia> f(1)
2-element Array{Int64,1}:
 0
 1

julia> f(17)
18-element Array{Int64,1}:
      0
      1
      1
      2
      3
      5
      8
     31
     93
    421
    415
    638
   3501
   9314
  51821
  53116
 739401
 715297

Haskell, 64 49 bytes
a!b=a:b!(read$reverse$show$a+b)
q n=0:take n(1!1)

Usage example: q 15 -> [0,1,1,2,3,5,8,31,93,421,415,638,3501,9314,51821,53116]
How it works: ! recursively builds an infinite list of iccanobif numbers starting with it's first argument (the second argument must be the next iccanobif number). q takes the first n numbers from the iccanobif list starting with 1, 1 and prepends a 0.

T-SQL, 149
Very straight forward inline table function that uses a recursive CTE query.  As it is using INTs this will top out at 37.  Adding in CASTs for bigints will allow it to go further to 63
create function i(@ int)returns table return with r as(select 0I,1N union all select n,reverse(i+n)+0from r)select 0n union all select top(@)n from r

It is used as follows
select * from i(0)
n
-----------
0

(1 row(s) affected)

select * from i(1)
n
-----------
0
1

(2 row(s) affected)

select * from i(6)
n
-----------
0
1
1
2
3
5
8

(7 row(s) affected)

select * from i(17)
n
-----------
0
1
1
2
3
5
8
31
93
415
421
638
3501
9314
51821
53116
715297
739401

(18 row(s) affected)

CJam, 18 bytes
U1{_2$+sW%i}ri*;]p

How it works
U1                      e# First two numbers in the series
  {        }ri*         e# Run the loop input numbers times
   _2$+                 e# Get sum of last two numbers in the series
       sW%i             e# Convert to string, inverse and convert back to a number
                ;       e# Remove the last number to get only first n + 1 numbers.
                 ]p     e# Wrap all numbers in an array and print the array

Try it online here

Java - 126 124
I haven't seen Java around this site in awhile...
void f(int b){for(int c=0,d=1,g;b-->=0;d=Integer.valueOf(new StringBuilder(c+(c=d)+"").reverse()+""))System.out.println(c);}

f(5) prints 0 1 1 2 3 5 8 31 93 421 415 638

I would also accept ...System.out.println(c);

@mbomb007 Thanks! Saved me 2 bytes.

You could probably shorten it using the numeric method to reverse a number since Java's string manipulation is costly.

I know it's been more than 1.5 years, but you can save 6 bytes by replacing Integer.valueOf( with new Long( (and then change the int in the for-loop to long as well). If you prefer to just work with integers instead, new Integer( is still shorter than Integer.valueOf(.

SWI-Prolog, 141 131 121 bytes
a(X,R):-X>1,A is X-1,a(A,B),reverse(B,[K,L|_]),W is K+L,name(W,Z),reverse(Z,Y),name(E,Y),nth0(X,R,E,B);X=1,R=[0,1];R=[0].

Running a(17,X). outputs:
[0, 1, 1, 2, 3, 5, 8, 31, 93, 421, 415, 638, 3501, 9314, 51821, 53116, 739401, 715297]

Takes about 10 seconds to output the result of a(10000,X). on my computer.
Edit: The 121 bytes version above is a one predicate definition = one liner.
The old 131 bytes version is the following (must be runned as p(17,X)):
a(0,[0]).
a(1,[1,0]).
a(X,[E|B]):-A is X-1,a(A,B),B=[K,L|_],W is K+L,name(W,Z),reverse(Z,Y),name(E,Y).
p(X,Y):-a(X,Z),reverse(Z,Y).

><> (Fish) 592 254 Bytes
Not super golfed (42/43 blanks that do nothing and a total of 30 redirection tokens) , but was an interesting exercise getting it working in the first place.
10!/{:}0=?v/{1-}}:{+:0}!/a,:1%-:0=?!v~{:1!/$:@0=?!v$~}}:&{{&*\
/-$/    ;n/\oo", "n:    \       }+1{/     \$-1$*a /|.!20}}01@/
* :{:}(?v:{!":}-1!/$:@0=?!v$~{:}1!/$:@0=?!v$~}}}:&{{{&*:1%-*&{{&+}}{1+}02.
b .1 +bb   \      \$-1$*a /       \$-1$,a /
\*9{~~~{/

You can test it here, providing the desired length in the initial stack.
EDIT: More than halved byte count

PHP, 114, 109 bytes
function f($n){if($n==0)return 0;$f=[0,1];for($i=2;$i<=$n;++$i){$f[$i]=strrev($f[$i-1]+$f[$i-2]);}return $f;}

Nothing fancy, just an average fibonacci algorithm with the string reverse magic.
Ungolfed:
function f($n)
{
    if($n == 0) return 0;
    $f = [0, 1];
    for ($i=2; $i<=$n; ++$i){
        $f[$i] = strrev($f[$i-1] + $f[$i-2]);
    }
    return $f;
}

Husk, 10 bytes
↑¡ȯ↔Σ↑_2ŀ2

Try it online!

JavaScript (ES2015), 81 73 bytes
(a,b=0,c=1)=>{for(;a-->-1;c=[...(b+(b=+c)+"")].reverse().join``)alert(b)}

Running this function (named f) with 6:
f(6);// alerts: 0, 1, 1, 2, 3, 5, 8

Excel VBA, 279 bytes
n = InputBox("n")
For i = 0 To n
If i < 2 Then
Cells(i + 1, 1) = i
ElseIf i > 6 Then
x = Cells(i, 1) + Cells(i - 1, 1)
l = Len(x)
v = CStr(x)
For j = 1 To l
r = r + Right(v, 1)
v = Left(v, l - j)
Next j
Cells(i + 1, 1) = r
r = ""
Else
Cells(i + 1, 1) = Cells(i, 1) + Cells(i - 1, 1)
End If
Next i

Running the macro will prompt the user to enter a value for n.
The results will then be printed row by row in column A:

Can you remove spaces in your code to make it shorter?

@mbomb007 when writing in Excel VBA the spaces are automatically entered, so I just leave them in.

Pip, 13 bytes
I'm pretty sure all the features used in this program were present in Pip before this question was asked.
LaSio:+RVi+oi

Takes input as command-line argument. Try it online!
Explanation
               a is 1st cmdline arg; i is 0; o is 1 (implicit)
La             Loop (a) times:
       RVi+o   Reverse of i+o
      +        Unary + treats its operand as a number, thus removing leading 0's
    o:         Assign the result to o...
  Si           ... before swapping i and o
            i  After the loop, output i

The two variables' values evolve like so:
Iter   o   i (output)
   0   1   0
   1   0   1
   2   1   1
   3   1   2
   4   2   3
   5   3   5
   6   5   8
   7   8  31
   8  31  93
   9  93 421
  10 421 415

Jelly, 7 bytes
+ṚḌɗÐ¡1

Try it online!
Reads n from STDIN
How it works
+ṚḌɗÐ¡1 - Main link. No arguments
        - By default, set the left argument to 0
      1 - Set the right argument to 0
    Ð¡  - Read n from STDIN and do the following n times:
          Start with x = 0, y = 1, then update according to
          x, y = y, f(x,y), collecting each intermediate step
   ɗ    - Define f(x, y):
+       -   x + y
 Ṛ      -   Reversed digits
  Ḍ     -   Back to integer

Vyxal W, 10 9 bytes
01?(~+Ṙ)_

Try it Online!
-1 thanks to Steffan
Similar to the CJam answer.
01?(~+Ṙ)_ # 'W' flag prints the entire stack
01        # Push 0, then 1
  ?(   )  # Loop input number of times
    ~+    # Add the previous 2 numbers without popping
      Ṙ   # Reverse the result (given a number, the output will be a number)
        _ # Pop the last result

You can remove the space because of how leading zeros are parsed.

You can do this to sve another byte: 01?(~+Ṙ…

R, 87 bytes
function(n)while(n+1){n=n-1;show(+F);F=T+(T=F);F=F%/%10^(z=0:log10(F))%%10%*%10^rev(z)}

Try it online!

Pushy, 18 bytes (non-competing)
Z1{:2d+vFs@KjkvF;_

Try it online!
It's not the most elegant of programs, but it works.
Z1     \ Push 0 and 1 to begin the sequence
{:     \ Input times do:
 2d+   \   Add the last two terms
 vF    \   Send to second stack
 s     \   Split into digits
 @Kjk  \   Reverse and join into one number
 vF;    \   Send back to first stack
_      \ At the end of the program, print the whole stack.

@mbomb007 yep, sorry!

Jelly, 9 bytes
0+ṚV$¥Ð¡1

Try it online!

R, 134 bytes
i=function(n){s=c(0,1);for(i in 3:n){s[i]=as.numeric(paste0(rev(strsplit(as.character(s[i-2]+s[i-1]),'')[[1]]),collapse=''))};cat(s)}

Example:
> i(10)
0 1 1 2 3 5 8 31 93 421

Would love to see if somebody had a better R alternative than to take your number, make it a string, reverse it and turn it back into a number again.

Groovy, 70 bytes
{r={"$it".reverse() as int};f={n->n<3?1:r(f(n-1))+r(f(n-2))};r(f(it))}

{
    r={"$it".reverse() as int};       // Reverse digits, costly using string.
    f={n->n<3?1:r(f(n-1))+r(f(n-2))}; // Recursive Iccanobbif implementation.
    r(f(it))                          // Reverse final output.
}

Japt, 10 bytes
Outputs the nth element, 0-indexed.
@Zä+ Ìsw}g

Try it


text:
Draw Growing Stacks of Boxes
The Task
In this challenge, your task is to draw an ASCII art representation of several stacks of boxes of increasing height.
You are given as input the number of stacks, which is a positive integer.
The first stack contains one box of size 2x2.
The second stack contains 2 boxes of size 3x3.
In general, the kth stack contains k boxes of size (k+1)x(k+1).
The borders of each box are drawn using the characters -|+, and their interior consists of whitespace.
Adjacent boxes share their borders, and corners should always be drawn with +, even when they are part of a border of another box.
Examples
Output for 1:
++
++

Output for 2:
 +-+
 | |
 +-+
++ |
++-+

Output for 3:
   +--+
   |  |
   |  |
   +--+
   |  |
 +-+  |
 | +--+
 +-+  |
++ |  |
++-+--+

Output for 5:
          +----+
          |    |
          |    |
          |    |
          |    |
          +----+
          |    |
          |    |
          |    |
      +---+    |
      |   +----+
      |   |    |
      |   |    |
      +---+    |
      |   |    |
      |   +----+
   +--+   |    |
   |  +---+    |
   |  |   |    |
   +--+   |    |
   |  |   +----+
 +-+  +---+    |
 | +--+   |    |
 +-+  |   |    |
++ |  |   |    |
++-+--+---+----+

Rules and Scoring
The input can be received from STDIN, as a command line argument, or as a function argument.
Output must go to STDOUT or closest equivalent.
Any finite amount of trailing whitespace is allowed, as are preceding and trailing newlines, but there cannot be any extra preceding spaces.
This is code-golf, so the lowest byte count wins.
Standard loopholes are disallowed.

I think this ascii output is a good illustration for how n and n-1 are relatively prime. Two pluses will never overlap.

Is there any maximum limit for the input number?

@ThomasWeller Only the maximum limit of your language's native integer type.

It seems that this is quite a limiting factor. Some of the submissions will not work for Integer.MaxValue as input.

@ThomasWeller Oh, you're right of course... it was not my intention to invalidate existing answers. Let's overrule that: a solution should work for all inputs for which the total number of required characters in the output does not exceed Integer.MaxValue or equivalent.

CJam, 64 60 58 bytes
]ri:X{'|'}{I))*\I**XX*)Se[s}:L~:M.e>S'-LaI*~M}fI]zN*'}/'+*

Constructing each column at a time.
Try it online here

Java (407 349 chars)
A few chars thanks to @Zgarb and @Geobits
Code
void s(int q){int d,h,y,i,j,x,z,t=q*q+1;char b;for(i=0;i<t;i++){z=x=0;d=t-i;for(j=0;j<(q*q+q)/2+1;j++){b=' ';h=x*x+1;if(x==z){y=x+1;if((d<=h&d%(x==0?1:x)==(x==1?0:1))|(y<=q&d<=y*y+1&d%(y==0?1:y)==(y==1?0:1)))b='+';else if(d<=h|y<=q&d<=y*y+1)b='|';x++;z=1;}else{if(d<=h&d%(x==0?1:x)==(x==1?0:1))b='-';z++;}System.out.print(b);}System.out.println();}}

Not sure if this is optimal, but it's my first attempt, I will probably try to put it in a better golfing language later. Any suggestions are welcome!
Expanded
class StackingBlocks{
    public static void main(String[]a){
        int d,h,y,i,j,x,z,t,q=10;
        t=q*q+1;
        char b;
        for(i=0;i<t;i++){
            z=x=0;
            d=t-i;
            for(j=0;j<(q*q+q)/2+1;j++){
                b=' ';
                h=x*x+1;
                if(x==z){
                    y=x+1;
                    if((d<=h&d%(x==0?1:x)==(x==1?0:1))|(y<=q&d<=y*y+1&d%(y==0?1:y)==(y==1?0:1)))
                        b='+';
                    else if(d<=h|y<=q&d<=y*y+1)
                        b='|';
                    x++;
                    z=1;
                }else{
                    if(d<=h&d%(x==0?1:x)==(x==1?0:1))
                        b='-';
                    z++;
                }
                System.out.print(b);
            }
            System.out.println();
        }
    }
}

Check it out here.

Quick tips for 10 bytes: 1) Replace && and || with & and |. 2) Move int declarations into the for (for(int i=0,j,x,z;...). 3) You have one too many braces at the end of your golfed function.

You have a lot of comparisons of the form a+1<=b+1; they can be replaced by a<=b.

q*q+1 should probably just be assigned to another variable. You use it 9 times or so, and you could save a bunch by saying a=q*q+1 once. Also, q*(q+1) is just q*q+q.

I was just doing that Geobits and Zgarb, thanks for the suggestions!

You could look for a recursive solution, maybe? It looks like there should be a nice one.

@mbomb007 I'm not sure how I would do that while printing, or do you suggest I save it during each step and print at the end?

I'm going to do that anyway, with the iterative approach I'm taking.

Okay, cool. Looking forward to seeing it

You can change (q*q+q)/2 to q*q+q>>1

Due to t=q*q+1 this does not work for any Integer q as input. Unfortunately OP has defined Integer.MaxValue as maximum input.

@ThomasWeller The OP changed that criterion now.

Python 2, 144 128 bytes
n=input()
i=n*n
while-~i:j=x=1;l="";exec'y=i%j<1;z=i>j*j;l+=j*z*" "or"|+"[x|y]+" -"[y]*~-j;x=y^z>z;j+=1;'*n;print l+"|+"[x];i-=1

Bit twiddling. Bit twiddling everywhere.

Python, 188 bytes
Mathematically calculates the character at each x,y position. It was tricky making the +s print on both sides of each box as well as stopping the rightmost +s of what would be n+1th boxes.
n=input();l=1;c=0
for y in range(n*n,-1,-1):
 s=""
 for x in range((n*n+n)/2+1):k=((8*x+1)**.5+1)/2;i=int(k);b=y<=i**2;s+=" |-+"[((k==i)+2*((y%l+c)*(y%i+(k==n+1))<1))*b];l=i;c=b^1
 print s

what does     (8*x+1)**.5+1  do ?

@Agawa001 Looks like an inverse triangle function.

@Geobits Beat me to answering what my own code does!

@Geobits yea i was thinkin of something like floor$sqrt(2n-sqrt(2n))$ ,

I'm not sure if this works for sys.maxint as input value. It seems n*n will overflow, or does Python switch to BigInteger then?

@ThomasWeller python will automatically convert that to a long which has no upper limit.

@ThomasWeller Python doesn't have a maximum input value. sys.maxint is only there for compatibility purposes, since it's still useful to know that 2**31-1 is the largest value for an integer.

@mbomb007 not for a BigInteger type

C# - 304 bytes (function)
void b(int s){int h=s*s,w=h+s>>1,x,y,j;var c=new int[w+1,h+1];for(;s>0;s--){for(y=s*s-s;y>=0;y-=s){x=s*s-s>>1;for(j=0;j<s;){c[x+j,y]=c[x+j,y+s]=13;c[x,y+j]=c[x+s,y+j++]=92;}c[x,y]=c[x+s,y]=c[x+s,y+s]=c[x,y+s]=11;}}for(y=h;y>=0;y--){for(x=0;x<=w;x++)Console.Write((char)(32+c[x,y]));Console.WriteLine();}}

or 363 bytes (full code)
namespace System{class C{static void Main(string[]a){int s=int.Parse(a[0]),h=s*s,w=h+s>>1,x,y,j;var c=new int[w+1,h+1];for(;s>0;s--){for(y=s*s-s;y>=0;y-=s){x=s*s-s>>1;for(j=0;j<s;){c[x+j,y]=c[x+j,y+s]=13;c[x,y+j]=c[x+s,y+j++]=92;}c[x,y]=c[x+s,y]=c[x+s,y+s]=c[x,y+s]=11;}}for(y=h;y>=0;y--){for(x=0;x<=w;x++)Console.Write((char)(32+c[x,y]));Console.WriteLine();}}}}

I tried to avoid if statements. Ungolfed:
namespace N
{
    public class Explained
    {
        static void boxes(string[] args)
        {
            int size = int.Parse(args[0]);
            int height = size * size + 1;
            int width = size * (size + 1) / 2 + 1;
            var canvas = new int[width, height];
            for (; size > 0; size--)
                drawboxes(size, canvas);

            for (int y = height - 1; y >= 0; y--)
            {
                for (int x = 0; x < width; x++)
                    Console.Write((char)(32 + canvas[x, y]));
                Console.WriteLine();
            }
        }

        static void drawboxes(int size, int[,] canvas)
        {
            int x = size * (size - 1) / 2;
            for (int i = size - 1; i >= 0; i--)
            {
                drawbox(x, i * size, size, canvas);
            }
        }

        static void drawbox(int x, int y, int size, int[,] canvas)
        {
            for (int i = 0; i < size; i++)
            {
                canvas[x + i, y] = 13; // +32 = '-'
                canvas[x + i, y + size] = 13;
                canvas[x, y + i] = 92; // +32 = '|'
                canvas[x + size, y + i] = 92;
            }
            canvas[x, y] = 11; // +32 = '+'
            canvas[x + size, y] = 11;
            canvas[x + size, y + size] = 11;
            canvas[x, y + size] = 11;
        }
    }
}

My solution does not work for any input of Integer range as defined by OP. I'd need to use long instead.

Python 2, 294 290
I got it working, but I still need to golf it more. I'm so happy, though, that was tough (for me, at least)!
I'll probably add an explanation later, unless it's immediately clear to someone...? I kind of doubt it.
Try it here
n=input()
w=n*n+n+2>>1
a=eval(`[[' ']*w]*-~n**2`)
r=range
j=[i*i+i>>1for i in r(n+1)]
p=0
for i in r(w):
 if i in j:
    p+=p<n
    for k in r(p*p+1):a[~k][i]='+'if k%p<1or' '<a[~k][i-1]<'.'else'|'
 else:
    for k in r(p*p+1):a[~k][i]=' 'if k%p else'-'
print'\n'.join(''.join(i)for i in a)

Ruby (205 bytes)
Takes the number as a command line arguments. It starts with a fail leading newlines, but that's allowed.
n=$*[0].to_i
m=n+1
f=m.times.inject(:+)+1
c=((" "*f+p=?+)*n*m).split p
y=0
1.upto(n){|b|(b*b+1).times{|x|d=x%b==0;r=c[x]
d&&b.times{|g|r[y+g]=?-}
r[y]=d||r[y]==p ?p:?|
r[y+b]=d ?p:?|}
y+=b}
puts c.reverse

JavaScript (ES6), 293 bytes
(n,o='',r,f,t,u,b,c,e=n*n+1,i)=>{for(t=0;e>t;t++){for(c=b=0,d=e-t,u=0;(n*n+n)/2+1>u;u++)i=" ",r=b*b+1,b==c?(f=b+1,d<=r&d%(0==b?1:b)==(1==b?0:1)|n>=f&d<=f*f+1&d%(0==f?1:f)==(1==f?0:1)?i="+":d<=r|n>=f&d<=f*f+1&&(i="|"),b++,c=1):(d<=r&d%(0==b?1:b)==(1==b?0:1)&&(i="-"),c++),o+=i;o+="\n"}return o}

I ran this in Firefox. Ignore the " the console adds between the strings. This is mostly ES5 stuff but I'll try to golf this more.
Ungolfed / ES5

function box(n, o, r, f, t, u, b, c, e, i) {
  if (o === undefined) o = "";
  if (e === undefined) e = n * n + 1;
  return (function() {
    for (t = 0; e > t; t++) {
      for (c = b = 0, d = e - t, u = 0;
        (n * n + n) / 2 + 1 > u; u++) i = " ", r = b * b + 1, b == c ? (f = b + 1, d <= r & d % (0 == b ? 1 : b) == (1 == b ? 0 : 1) | n >= f & d <= f * f + 1 & d % (0 == f ? 1 : f) == (1 == f ? 0 : 1) ? i = "+" : d <= r | n >= f & d <= f * f + 1 && (i = "|"), b++, c = 1) : (d <= r & d % (0 == b ? 1 : b) == (1 == b ? 0 : 1) && (i = "-"), c++), o += i;
      o += "\n";
    }
    return o;
  })();
}

document.getElementById('g').onclick = function(){ document.getElementById('o').innerHTML = box(+document.getElementById('v').value) };
<input id="v"><button id="g">Run</button>

Python - 243 bytes
Generates all the columns, replacing the overlaps on columns except the first one. Then it pads with spaces, transposes, and prints.
Q=input()
Y=[]
for i in range(Q):
    f="+"+i*"-"+"+";x=map(list,zip(*([f]+["|"+" "*i+"|"]*i)*(i+1)+[f]))
    if i:y=Y.pop();x[0][-len(y):]=y
    Y+=x
print"\n".join("".join(i)for i in zip(*["".join(j[::-1]).ljust(Q*Q+1," ")for j in Y])[::-1])

I am considering translating to Pyth, but I will need a replacement for the pad function.


text:
Cut a silicon wafer into dies
When manufacturing chips, circular silicon wafers are cut into dies of needed size:

The goal of this challenge is maximizing the number of whole dies that can be cut from a wafer of a given diameter.
The machine puts the wafer into an angular compartment:
_____________________
|     xxxxxx
|  xxxxxxxxxxxx
| xxxxxxxxxxxxxx
|xxxxxxxxxxxxxxxx
|xxxxxxxxxxxxxxxx
| xxxxxxxxxxxxxx
|  xxxxxxxxxxxx
|     xxxxxx     (this ascii art is meant to be a perfect circle)

It measures a distance dx from the left edge, and makes a vertical cut. Then it makes the needed number of additional vertical cuts, with spacing of the needed width. It makes the horizontal cuts in the same way: first one at a distance dy, and then with spacing of height.
The material remains perfectly still during the cutting: it's not allowed to move some slices of material before making the perpendicular cuts.
The machine has a stepper motor that works at absolute accuracy but can only go integer-sized distances.
Make a program or a subroutine that gets (or reads) the following parameters:

Wafer diameter
Die width
Die height

and outputs (or prints)

dx - horizontal starting position
dy - vertical starting position

such that the number of rectangular dies is maximal.
Some fine points:

If a corner of a die lies exactly on the circumference of the circle, the die is considered usable (rectangular)
No edge cases: you can assume that the wafer's diameter is even; at least one die can be cut out; also make other reasonable assumptions
All sizes are integer numbers of millimeters; maximum wafer diameter is 450

Shortest code wins!
P.S. The code must finish running in a reasonable amount of time, e.g. over a weekend (2 days) - for wafer diameter equal to 300.
P.P.S. If there are several different output values that are optimal, the code must output one of them - no need to output all of them!
Test cases:
Wafer diameter 8, die size 2 x 2 => dx = 0, dy = 1 (6 dies)
Wafer diameter 20, die size 5 x 4 => dx = 1, dy = 2 (10 dies)
Wafer diameter 100, die size 12 x 12 => dx = 9, dy = 3 (41 dies)
Wafer diameter 300, die size 11 x 11 => dx = 7, dy = 7 (540 dies) - a realistic example
Wafer diameter 340, die size 15 x 8 => dx = 5, dy = 2 (700 dies) - a Pythagorean triple
Wafer diameter 300, die size 36 x 24 => dx = 2, dy = 6 (66 dies) - full-frame sensors

Here is a visualization of the last test case:

Must finish in a reasonable time for what input bounds?

I thought the answers to these questions were obvious; added a clarification anyway.

Bloody hell, over a weekend?! Who has the patience to test that...

Can you provide some test cases?

@BetaDecay 2 days is just an upper limit to allow brute-force solutions using languages that are unsuitable for this task. It's OK if your code runs much faster (maybe less than 1 second).

@AlexA. The sizes of the dies are parameters to the function/program. I guess this counts as "fixed".

Ugh, sorry. Brain flatulence.

Must dx and dy be rounded to integers before calculating the number of dies? This might result in sub optimal die counts...

@agtoever dx and dy are integers (the question specifies this, really)

Note: dx and dy are often used in calculus.

Java, 242
This is a method that takes the three input parameters and returns a string containing optimal values for dx and dy.
String k(int d,int w,int h){int m=0,f=0,g=0,r=d/2,s=r*r+1,a,b,p=-1;while(++p<w)for(int q=-1;++q<h;)for(int x=p-r,c=0;(a=x+w)<r;x=a)for(int y=q-r;(b=y+h)<r;y=b)if(x*x+y*y<s&&a*a+b*b<s&&x*x+b*b<s&&a*a+y*y<s&&++c>m){m=c;f=p;g=q;}return f+" "+g;}

Ungolfed:
String k(int diameter, int width, int height) {
    int
        maxDieCount = 0,
        bestDx = 0,
        bestDy = 0,
        radius = diameter / 2,
        radiusSquared = radius * radius;
    for (int dx = 0; dx < width; ++dx) {
        for (int dy = 0; dy < height; ++dy) {
            int dieCount = 0;
            for (int x1 = dx - radius; x1 + width < radius; x1 += width) {
                int x2 = x1 + width;
                for (int y1 = dy - radius; y1 + height < radius; y1 += height) {
                    int y2 = y1 + height;
                    if (    x1 * x1 + y1 * y1 <= radiusSquared &&
                            x2 * x2 + y2 * y2 <= radiusSquared &&
                            x1 * x1 + y2 * y2 <= radiusSquared &&
                            x2 * x2 + y1 * y1 <= radiusSquared )
                        ++dieCount;
                }
            }
            if (dieCount > maxDieCount) {
                maxDieCount = dieCount;
                bestDx = dx;
                bestDy = dy;
            }
        }
    }
    return bestDx + " " + bestDy;
}

Pretty straightforward bruteforce approach - try every dx in [0, width) and every dy in [0, height), then loop through every rectangle in the resulting grid and check if all four corners are inside the circle (using basic pythagorean relations), count the number of such rectangles, and return the first dx and dy that produced the highest count for the given configuration.
Test with: (assuming both methods are placed in a class named CG52148)
public static void main(String[] args) {

    CG52148 o = new CG52148();
    System.out.println("8\t2\t2\t=> " + o.k(8, 2, 2));
    System.out.println("20\t5\t4\t=> " + o.k(20, 5, 4));
    System.out.println("100\t12\t12\t=> " + o.k(100, 12, 12));
    System.out.println("300\t11\t11\t=> " + o.k(300, 11, 11));
    System.out.println("340\t15\t8\t=> " + o.k(340, 15, 8));
    System.out.println("300\t36\t24\t=> " + o.k(300, 36, 24));

}

The third test case produces 0 8 rather than 9 3, but they are both valid, equally optimal, and are both found by my algorithm.

Python 2.7, 317
Here is my solution. Could be golfed a bit more, I think - but I like the solving better than the golfing. Suggestions are welcome.
I solve it using brute force, iterating over all dx and dy and then counting by column. It all runs pretty fast (<0,05 sec. on my Mac).
Code:
import math as m
def D(d,w,h):
 r=d/2
 s=[0,0,0]
 for dx in range(0,w):
  for dy in range(0,h):
   t=0
   for c in range(1,int(d/w)+1):
    l=r-dx-(c-1)*w
    if l<w/2:
     l-=w
    if abs(l)<=r:
     f=r*m.sin(m.acos(1.0*l/r));t+=int((2.0*f-(dy+m.ceil((r-dy-f)/h)*h+f-r))/h)
   if t>s[0]:
    s=[t,dx,dy]
 return s

A main to test and profile the given cases:
def runTestcases():
    for d,w,h in [[8,2,2],[20,5,4],[100,12,12],[300,11,11],[340,15,8],[300,36,24]]:
        S=D(d,w,h)
        print "Wafer diameter {}, die size {} x {} => dx = {}, dy = {} ({} dies)".format(d,w,h,S[1],S[2],S[0])

def main():
    import cProfile
    cProfile.run("runTestcases()")

if __name__ == "__main__":
    main()

And its output:
Wafer diameter 8, die size 2 x 2 => dx = 0, dy = 1 (6 dies)
Wafer diameter 20, die size 5 x 4 => dx = 1, dy = 2 (10 dies)
Wafer diameter 100, die size 12 x 12 => dx = 0, dy = 8 (41 dies)
Wafer diameter 300, die size 11 x 11 => dx = 7, dy = 7 (540 dies)
Wafer diameter 340, die size 15 x 8 => dx = 5, dy = 2 (700 dies)
Wafer diameter 300, die size 36 x 24 => dx = 2, dy = 6 (66 dies)
         55354 function calls in 0.049 seconds