text:
Smallest positive integer which is coprime to the last two predecessors and has not yet appeared; a(1)=1, a(2)=2
Definition

Two integers are coprime if they share no positive common divisors other than 1.
a(1) = 1
a(2) = 2
a(n) is the smallest positive integer which is coprime to the a(n-1) and a(n-2) and has not yet appeared, for integer n >= 3.

Task

Given positive integer n, output/print a(n).

Example

a(11) = 6 because 6 is coprime with the last two predecessors (namely, 11 and 13) and 6 has not appeared before.

Notes

Note that the sequence is not ascending, meaning that an element can be smaller than its predecessor.

Specs

You must use 1-indexed.

Testcases
n      a(n)
1      1
2      2
3      3
4      5
5      4
6      7
7      9
8      8
9      11
10     13
11     6
12     17
13     19
14     10
15     21
16     23
17     16
18     15
19     29
20     14
100    139
1000   1355
10000  13387
100000 133361

Scoring

Since coprime means that the two numbers share only one divisor (1), and 1 is a small number, your code should be as small as possible in terms of byte-count.

References

OEIS A084937

Those "reasons" for short code...

I wonder why this was downvoted. Surely not because of the horrible rationale?

@Conor Not me. Actually I upvoted. I hope people will see both the rationale and my comment as jokes

@LuisMendo you misunderstand my comment. The placement is merely unfortuante and has no bearing on your comment ;)

@ConorO'Brien I didn't mean you were referring to me. But I wanted to clarify :-)

The problem with these "funny" justifications for code golf is that I need to read a bad joke spanning four lines just to find out that this is standard code golf. It's simply obscuring the challenge's rules for no good reason.

@MartinEnder Really? I see it in the title of the page.

@ConorO'Brien Not all browsers always show the title (and then there's the mobile app), and we generally describe the scoring in the post in addition to using the tag, because the tag alone doesn't mean anything to people who are new to the site. Even though I am familiar with our challenge type tags, I never read them to figure out how a challenge is scored but try to find that in the challenge body. The tag is for categorisation, searchability and challenge-type specific information in the tag wiki.

@MartinEnder that makes sense.

So are we generating a sequence, or just the value for a given n?

@GlenO Clarified.

Python 3.5, 160 141 126 124 121 109 bytes
This is a simple implementation of the sequence's definition. Golfing suggestions welcome.
Edit: -17 bytes thanks to Leaky Nun. -9 bytes thanks to Peter Taylor. -6 bytes thanks to Sp3000 and switching to Python 3.5.
import math;f=lambda n,r=[2,1],c=3:n<2and r[1]or(c in r)+math.gcd(c,r[0]*r[1])<2and f(n-1,[c]+r)or f(n,r,c+1)

Ungolfing:
import math
def f(n, r=[2,1], c=3):
    if n<2:
        return r[1]
    elif (c in r) + math.gcd(c,r[0]*r[1]) < 2:
        return f(n-1, [c]+r)
    else:
        return f(n, r, c+1)

For Python 3.5+, import math then g=math.gcd should be shorter than defining your own g. For before 3.5, you can do from fractions import* for gcd.

If you initialise c=3 inside the loop you only need to do it once. By my count you save 3 chars.

There's also a 2-char saving from building the array the other way round: you have to use r=[c]+r rather than +=, but three negative indices become positive. And then there's a further 2-char saving from rewriting as a lambda, although that's a pretty drastic change: from fractions import*;F=lambda n,r=[2,1],c=3:n<2and r[1]or(c in r)+gcd(r[0]*r[1],c)<2and F(n-1,[c]+r)or F(n,r,c+1) and no need for a print because it's no longer a full program.

MATL, 28 27 bytes
2:i:"`@ym1MTF_)Zdqa+}@h]]G)

The code is slow, but gives the correct result.
Try it online! Or verify the first ten cases.
A small modification of the code produces a plot of the sequence:
2:i:"`@ym1MTF_)Zdqa+}@h]]G:)XG

See it as ASCII art, or with graphical output in the offline compiler:

Explanation
2:         % Push [1 2] to initiallize the sequence
i:         % Input n. Push [1 2 ... n]
"          % For loop: repeat n times
  `        %   Do while loop
    @      %     Push iteration index, starting at 1. This is the candidate number
           %     to extend the sequence
    y      %     Duplicate vector containing the sequence so far
    m      %     Is member? Gives true if the candidate is in the sequence
    1M     %     Push candidate and vector again
    TF_)   %     Get last two elements of the vector
    Zd     %     GCD between the candidate and those two elements. Produces a
           %     two-element vector
    qa     %     True if any of the two results exceeds 1, meaning
           %     the candidate is not coprime with the latest two sequence values
    +      %     Add. This corresponds to logical "or" of the two conditions, namely
           %     whether the candidate is member of the sequence so far, and
           %     whether it is not coprime with the latest two. In either case
           %     the do...while must continue with a next iteration, to try a new
           %     candidate. Else the loop is exited, and the current candidate
           %     is the new value of the sequence
  }        %   Finally (execute when the loop is exited)
    @h     %     Push current candidate and concatenate to the sequence vector
  ]        %   End do...while
]          % End for
G)         % Get n-th value of the sequence. Implicitly display

C, 185 bytes
G(a,b){return a%b?G(b,a%b):b;}
i,j,k;f(n){int a[n+2];for(i=0;i++<n;){a[i]=i<3?i:0;for(j=2;!a[i];++j){for(k=i;--k;){if(a[k]==j)++j,k=i;}a[G(a[i-1],j)*G(a[i-2],j)<2?i:0]=j;}}return a[n];}

Actually, 38 37 35 33 31 30 bytes
This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!
Edit: -3 bytes thanks to Leaky Nun.
2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E

Ungolfing:
2R#╗    Push [1,2] and store it in register 0
,;      Take input and duplicate
`1      Start function, push 1
  "       Start string
  ;       Duplicate i
  2±╜t    Push (list in register 0)[-2:]
  πg      gcd(i, product of list[-2:])
  @╜í     Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found)
  +Y      Add the gcd and the index, negate (1 if coprime and not found in list, else 0)
  "£      End string, turn into a function
╓       Push first (1) values where f(x) is truthy, starting with f(0)
╖`      Append result to the list in register 0, end function
n       Run function (input) times
D╜E     Return (final list)[n-1]

Stack manipulation much

Haskell, 81 73 bytes
c l@(m:n:_)=m:c([x|x<-[1..],gcd(m*n)x<2,all(/=x)l]!!0:l)
((0:1:c[2,1])!!)

Usage example: ((0:1:c[2,1])!!) 12-> 17.
Build the list of all a(n), starting with 0 to fix the 1-based index and 1 and followed by c[2,1]. c takes the head of it's argument list l followed by a recursive call with then next number that fits (co-prime, not seen before) added in front of l. Pick the nth element of this list.

R, 141 bytes
 f=Vectorize(function(n)ifelse(n>3,{c=3;a=f(n-1);b=f(n-2);d=f(4:n-3);while(!c%%which(!a%%1:a)[-1]||!c%%which(!b%%1:b)[-1]||c%in%d)c=c+1;c},n))

ungolfed
f=Vectorize( function(n)     #build a recursive function. Vectorize allows
    if(n>3) {                #the function to be called on vectors.
        c=3                  #Tests size. Builds some frequent variables.
        a=f(n-1)
        b=f(n-2)
        d=f(4:n-3)           #Should really golf this out, but its horribly slow.
        while(!c%%which(!a%%1:a)[-1]||!c%%which(!b%%1:b)[-1]||c%in%d)
              c=c+1          #If we are coprime and not already seen. add.
        c
     } else n)               #First three are 1,2,3.

Mathematica, 97 90 bytes
a@1=1;a@2=2;a@n_:=SelectFirst[Range[2n],GCD[a[n-1]a[n-2],#]<2&&!MemberQ[a/@Range[n-1],#]&]

Based on my conjecture that a(n) < 2n for all n.
To get a faster run, add a@n= after the original := so that the function doesn't need to recalculate previous values.
Saved 7 bytes thanks to Sherlock9 (if gcd(a,b)=1 then gcd(ab,m) = gcd(a,m)*gcd(b,m))

It is not a conjecture, since it is written in the OEIS page that "ABS(a(n)-n) < n"

@LeakyNun Thanks. The OEIS page was down until a few moments ago, and I was worried about a possible counterexample for large n.

Pyth, 23 bytes
eu+Gf&-TGq1iT*F>2G1tQ]1

Test suite
A fairly straightforward implementation, but with some nice golfing tricks.
eu+Gf&-TGq1iT*F>2G1tQ]1
 u                 tQ]1    Apply the following function input - 1 times,
                           where G is the current state (List of values so far)
  +G                       Add to G
    f             1        The first number, counting up from 1
      -TG                  That has not been seen so far
     &                     And where
               >2G         The most recent two numbers
             *F            Multiplied together
           iT              Gcd with the current number being checked
         q1                Equals 1
e                          Output the final element of the list.


text:
Blunt the Images
Introduction
Sharp edges are, frankly, just plain dangerous so, given a PNG as input, blur the image using the method described below and blunt those damned sharp edges.
Method
To get the RGB value of each pixel, use the following three equations:
$$R = \sqrt{\frac{1.5\times\sum^n_{a=1}R^2_a}{n}}$$
$$G = \sqrt{\frac{1.5\times\sum^n_{a=1}G^2_a}{n}}$$
$$B = \sqrt{\frac{1.5\times\sum^n_{a=1}B^2_a}{n}}$$
Where \$\sum^n_{a=1}R^2_a\$ is the sum of the red values of each of the adjacent pixels squared. The value of \$n\$ is the number of adjacent pixels (e.g., a corner pixel will have an \$n\$ value of 3, whilst a pixel around the center of the image will have an \$n\$ value of 8).
An adjacent pixel is a pixel which is 1 pixel away from the original pixel in all directions (left, right, up, down and on all of the diagonals).

For example, in the following 3 x 1 image:

The blurred RGB value of the middle pixel will be:
$$R = \sqrt{\frac{1.5*(0^2+0^2)}{2}} = 0$$
$$G = \sqrt{\frac{1.5*(0^2+255^2)}{2}} = 220.836 = 221$$
$$B = \sqrt{\frac{1.5*(255^2+0^2)}{2}} = 220.836 = 221$$
where any decimal outputs are rounded to the nearest unit. You should not simply floor the result.
Therefore, the middle pixel will be the colour (0, 221, 221), or:

Resulting in the image:

You should repeat this process for every pixel in the image. (Note that you do this with the original pixels and not the modified pixels. Basically, you shouldn't overwrite the original image, and should keep it completely separate from the new, blurred image).
If you calculate any values to be greater than 255, assume that its value is 255 (I.e., a value of 374 would be set to 255).
The resulting output should be a separate PNG image (you may name this whatever you wish).
Examples
Super Mario
Original:

Blurred:

Checkerboard
Original:

Blurred:

Crisps
Original

Blurred

Not so crisp anymore
American Gothic
Original:

Blurred:

To see the blur on larger images, it's best to run the program again on the blurred image:

Challenge
The shortest code to blur a given PNG image wins.
You can use image processing libraries (such as PIL) but you must not use built-in blurring functions (Mathematica, I'm looking at you).
Note
As @orlp says below:

For the record, (to my knowledge) this is not a standard blurring method. This challenge is not an educational resource.

I am not really happy with that scaling. n should appear in the denominator.

I thought of something very different when I saw "Blunt" :P.

For the record, (to my knowledge) this is not a standard blurring method. This challenge is not an educational resource.

If you had a white pixel surrounded by 8 white pixels (all rgb(255,255,255)), the blurred pixel would be rgb(312,312,312).  Are we just supposed to clamp values into the range [0,255]?

How did you get rgb(0,221,221) from red surrounded by all reds (rgb(255,0,0))?  It looks like your calculation is averaging two numbers instead of eight.  That's impossible since all pixels must have 3, 5, or 8 neighbors, unless the image was less than 3×3 px, but your sample image was sufficiently large enough.  Are you sure you were using the center pixel?

@kamoroso94 1: Yes, assume any number greater than 255 is 255. 2: The example image is supposed to represent a 3 x 1 image.

If the image is 1×1,  there will be no adjacent pixels.  Should the blurred image be black or stay the same color?

@kamoroso94 By the reasoning of the question, it should be black

@Mego They are just 1 pixel away and include diagonal directions (hence the n value of 8)

Will you repost this with a pure 3D array I/O? If not, may I?

@Adám Go ahead :)

Python, 354 313 bytes
Not the best, but hey...
Using Space for 1st level indentation, Tab for 2nd level, then Tab+Space and Tab+Tab
import Image as I
A=I.open(raw_input())
w,h=A.size
B=I.new('RGB',(w,h))
s=[-1,1,0]
r=range
for x in r(w):
 for y in r(h):
    P=[]
    for d in s:
     for e in s:
        try:P+=[A.load()[x+e,y+d]]
        except:0
    P.pop()
    B.load()[x,y]=tuple(min(int(.5+(1.5*sum([v*v for v in t])/len(P))**.5),255)for t in zip(*P))
B.save("b.jpg")

Edit1: replacing math.sqrt() with ()**.5 thanks to beta decay
Edit2: using min for clamping (saving a lot!) and 0 for pass thanks to Loovjo
Edit3: +=[] for .append() saving 5 bytes
Edit4: using the variable s for the stencil

Surely n**0.5 is shorter than import math;math.sqrt(n)? Is there a reason for the latter?

Yes it is, no there is no reason. I just forgot.

v if v<256 else 255 can be shortened to min(v,255)

You can also replace pass with 0

You need to state which image library you're using. If you're using PIL/Pillow (and it looks like you are), the top import statement should read from PIL import Image as I.

@JF Python 3 don't support mixing tabs and spaces

@TùxCräftîñg wow! Never would've thought of that!

@Mego I'm not sure, but I think  import Image as I will work without saying from PIL import Image as I

@Mego http://codegolf.stackexchange.com/questions/39815/draw-a-fractal-in-under-200-characters/39827#39827

1.5 could be changed to .5.

@βετѧΛєҫαγ Ohhh. I was so used to look at 0.5. My apologies.

MATLAB, 130 bytes
Takes an image as an input and saves the output as b.png.
i=double(input(''));m=ones(3);m(5)=0;k=@(x)imfilter(x,m);imwrite(uint8(round((1.5*k(double(i.^2))./k(i(:,:,1)*0+1)).^.5)),'b.png')

source: Stack Exchange

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

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

sort: votes


text:
Verify a ballot triangle
A ballot number, which we'll label B, is the number of ways of arranging the numbers from 1 through B(B+1)/2 into a triangle, such that each row and column is in any increasing order. The first four ballot numbers are:
a(0) = 1
a(1) = 1
a(2) = 1
a(3) = 2

a(3) is 2, which means that there are 2 ways of arranging the numbers from 1 to 3(3+1)/2 = 6 in such a triangle:
1          1
2 3    or  2 4
4 5 6      3 5 6

See the OEIS sequence entry for more details.
Your challenge, given a ballot triangle, is to verify its correctness. If it satisfies the conditions of a ballot triangle (rows and columns increasing), you should output how many other ways (excluding the one in the input) there are to arrange the triangle correctly. If the input triangle is incorrectly constructed, you should output nothing.
Trailing newlines are allowed.
Input
A triangle of numbers, which may or may not be a valid ballot triangle. For example:
1
2 3
4 5 6

1
10 5
9 8 2
7 6 4 3

1
3 2

9
2 11
14 3 5
12 8 1 7
15 13 10 4 6

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21

Output
If the input is a valid ballot triangle, the remaining number of ways to arrange the same numbers in a valid ballot triangle. If the input is not a valid ballot triangle, nothing. For example, the inputs above produce these outputs (<nothing> is a placeholder for an actual empty output):
1                     # the same as a(3)-1

<nothing>

<nothing>

<nothing>

33591                 # the same as a(6)-1

Scoring
This is code-golf: as usual, lowest byte-count wins. Tiebreaker is earliest posted.

You should probably mention that the columns are also in increasing order.  That confused me until I looked up the OEIS definition.

Then why isn't 1/4 5/2 3 6 valid?

Spec fixed - I read the OEIS entry wrong. @ballesta25

c.c. @LeakyNun ^

Can we assume that the input will contain the correct numbers, even if not in the correct order?

@Dennis yes you can

Jelly, 20 bytes
;Zµ⁼Ṣ€
ẋÇFŒ!ṁ€⁸ÇÐfL’

For valid ballot triangles, run time and memory usage are at least O(n!), where n is the number of entries of the triangle. Invalid ones are recognized by crashing, thus printing nothing.
Try it online!
Test run
Locally, I was able to verify that a(4) is calculated correctly.
$ time jelly eun ';Zµ⁼Ṣ€¶ẋÇFŒ!ṁ€⁸ÇÐfL’' '[1],[2,3],[4,5,6],[7,8,9,10]'
11

real    6m9.829s
user    6m7.930s
sys     0m2.579s

How it works
;Zµ⁼Ṣ€         Helper link. Argument: T (triangular array)

 Z             Zip/transpose T.
;              Concatenate the original and the transposed copy.
  µ            Begin a new monadic chain, with the previous result (R) as argument.
    Ṣ€         Sort each array in R.
   ⁼           Test for equality with R.
               This returns 1 if T is a ballot triangle, 0 if not.

ẋÇFŒ!ṁ€⁸ÇÐfL’  Main link. Argument: A (triangular array)

 Ç             Call the helper link with argument A.
ẋ              Repeat A that many times.
               This yields an empty array if A is not a ballot triangle.
  F            Flatten the result.
   Œ!          Generate all permutations of the digits of A.
     ṁ€⁸       Mold each permutation like A, i.e., give it triangular form.
               This crashes if permutation array is empty.
        ÇÐf    Filter; keep permutations for which the helper link returns 1.
           L’  Compute the length and decrement it.

Brachylog, 44 bytes
{:{o?}a,?z:2a},?ly+yb:3flw
p~c.:laBtybB,.:1&

Try it online!
This runs in double-exponential time, so for truthy testcases you would need to believe me that it theoretically produces the correct result, for triangles with length greater than or equal to 3.
You can still test for falsey testcases, those should terminate rather quickly.

I've had to update the spec - both rows and columns should be increasing. Result of me reading the OEIS entry incorrectly. Sorry if that invalidates your answer!

@ArtOfCode That was what my answer does all along

JavaScript (ES6), 143 bytes
a=>a.some((b,i)=>b.some((c,j)=>c<b[j-1]||i&&c<a[i-1][j]))?'':(f=n=>n<2||n*f(n-1),g=(n,m=f(n*n+n>>1))=>n<2?m:g(--n,m*f(n)/f(n+n+1)),g(a.length))

Searches the triangle for an invalid entry and then uses a recursive formulation of the formula in OEIS to calculate the result.

I've had to update the spec - both rows and columns should be increasing. Result of me reading the OEIS entry incorrectly. Sorry if that invalidates your answer!

@ArtOfCode No, I was already checking that, but thanks anyway.

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


text:
One out of Infinity: Interpolating polynomials
For this challenge, when given a list of (x,y) points your submission needs to output a polynomial function that goes through all of them.
For example, if your points were [(0,0), (2,5)], you could return y = 2.5*x or y = x + 1/4x^2.

All points passed in will consist only of integers
Two points will never have the same y value
Your function be of the form y = a*x^n + ... b*x^m.   Reducing of terms is allowed.
Constants (the exponent and coefficient) can either be in decimal or fractional form.  Decimals should be accurate to at least 3 decimal places
You should be able to handle an arbitrary number of points
Output must be a string starting with "y=". Whitespace anywhere in the string is fine.

Test cases
Note, the given output is not the only valid output, just one of the possibilities.
(1,4)                                                    -> y=x+3
(0,0), (1,8)                                             -> y=8x
(0,6), (-1,90)                                           -> y=-84x+6
(6,4), (70,4), (-1,-6)                                   -> y=−10/497x^2+760/497x−316/71
(4,5), (5,6), (6,7)                                      -> y=x+1
(20,1), (-20,1), (0,5), (10, 4), (11,12), (17,4), (2,4)  -> y=488137/10424165400x^6−643187/473825700x^5−87561839/10424165400x^4+550999039/1042416540x^3−21590713027/5212082700x^2+300110420/52120827x+5

This is a code-golf, so make your answers as short as possible in your favorite language!

Your title says something about plotting but the challenge about outputting polynomials. Having the corresponding results for your test cases would probably help clear this up (and make the test cases a lot more useful).

Also how about built-ins? (Mathematica's is InterpolatingPolynomial so it's probably not at risk of winning.)

Builtins are fine.

The output needs to be a string. The input is flexible

Can coefficients in the output be (string representations of) floats instead of fractions? Say with 4 decimals?

Does the output need y=? Do exponents have to be explicitly listed?

@LuisMendo yes.

PS: I think you know about the existence of the sandbox by now :D

@flawr I know, I didn't expect so many problems when posting this challenge.

I don't think so. I'm organizing input as a list of x,y pairs

You are right. Sorry

Bah, it is a duplicate. I thought I did a pretty good search as well.

MATL, 38 bytes
ynq3$ZQ'y=' '%+fx^%i'btn:qP&vYDh1J3-h)

Inputs are an array with the x values and an array with the y values.
Try it online!
y          % Inplicitly take the two inputs, and push another copy of the first
nq         % Get its length minus 1. This is the required polynomial degree.
3$ZQ       % Coefficients of polynomial fitted to those data (`polyfit`)
'y='       % Push this string
'%+fx^%i'  % Push format string for `sprintf`
b          % Bubble up the polynomial coefficients to the top of the stack
tn:qP      % Duplicate and produce [n n-1  ... 0] where n is the polynomial degree.
           % These are the exponents
&v         % Concatenate vertically. This gives a 2D array with the coefficients in
           % the first row and the exponents in the second
YD         % Apply `sprintf` to this array with previous format string. The array
           % is read in column-major order: down, then across
h          % Concatenate 'y=' and formatted string representing the polynomial
1J3-h)     % The string ends in '...x^0'. Remove last three chars to delete this.
           % Implicitly display

Python2 + sympy, 61 58 bytes
from sympy import*;print interpolate(input("y="),var("x"))

You can use var instead of Symbol. Also, not that it matters, but input("y=") gets rid of that unbalanced spacing around =.

Matlab (with Symbolic Toolbox), 52 bytes
Using builtins for calculating an interpolation polynomial, and then converting it to a symbolc expression for pretty printing and back to a string for the actual output. This function takes two lists of coordinates, e.g. [6,70,-1] and [4,4,-6] for the fourth test case.
 @(x,y)['y=',char(poly2sym(polyfit(x,y,numel(x)-1)))]

I think this should be titled "Matlab with Symbolic Toolbox". Good job!

Here it was kinda obvious, but many times I don't even know whether I'm using one of those toolboxes. =)


text:
Given an integer, compute its Levenshtein code
Disclaimer: Levenshtein coding is completely unrelated to the Levenshtein edit distance metric.
<Insert long story about why Levenshtein codes need to be calculated here.>
The code
Levenshtein coding is a system of assigning binary codes to nonnegative integers that retains some weird property in probability which isn't relevant for this challenge. We will denote this code as L(n). Wikipedia describes this as a five-step process:

Initialize the step count variable C to 1.
Write the binary representation of the number without the leading 1 to the beginning of the code.
Let M be the number of bits written in step 2.
If M is not 0, increment C, repeat from step 2 with M as the new number.
Write C 1 bits and a 0 to the beginning of the code.

However, the code can also be described recursively:

If the number is 0, then its code is 0.
Write the binary representation of the number without the leading 1 to the beginning of the code.
Let M be the number of bits written in step 2.
Write L(M) to the beginning of the code.
Write a 1 bit to the beginning of the code.

For those who prefer examples, here is the recursive process for L(87654321), with  denoting concatenation:

The challenge
Write a program or function that, given a number n, outputs the bitstring L(n) in any reasonable format (this includes returning a number with said bits). Standard loopholes are, as always, disallowed.
Examples
Input: 5
Output: 1110001
Input: 30
Output: 111100001110
Input: 87654321
Output: 111110000101001001110010111111110110001
Input: 0
Output: 0

Jelly, 13 11 bytes
Ḣ;LÑ$;
BÇṀ¡

Try it online! or verify all test cases.
How it works
The submission consists of a pair of mutually recursive links.
BÇṀ¡    Main link. Argument: n

B       Convert n to binary.
   ¡    Execute...
 Ç        the helper link...
  Ṁ       m times, where m is the maximum of n's binary digits.

Ḣ;LÑ$;  Helper link. Argument: A (array of binary digits)

Ḣ       Head; remove and return the first element of A.
    $   Combine the two links to the left into a monadic chain.
  L       Yield the length (l) of A without its first element.
   Ñ      Call the main link with argument l.
 ;      Concatenate the results to both sides.
     ;  Append the tail of A.

Haskell, 70 bytes
b 0=[]
b n=b(div n 2)++[mod n 2]
f 0=[0]
f n|1:t<-b n=1:f(length t)++t

Defines a function f : Int -> [Int]. For example, f 5 == [1,1,1,0,0,0,1].

Python, 49 bytes
f=lambda n:n and'1%s'%f(len(bin(n))-3)+bin(n)[3:]

Test it on Ideone.

Mathematica, 61 bytes
f@0={0};f@n_:=Join[{1},f@Length@#,#]&@Rest@IntegerDigits[n,2]

I'm pretty sure you can save a few bytes by defining a unary operator ± instead of a function f.

JavaScript (ES6), 54 52 bytes

f=n=>(s=n.toString(2)).replace(1,_=>1+f(s.length-1))
<input type=number oninput=o.textContent=f(+this.value)><pre id=o>

Edit: Saved 2 bytes thanks to @Arnauld.

I think you can safely use replace(1,... instead of replace(/1/,... => 52 bytes

Pyth, 12 bytes
L&bX1.Bbyslb

Demonstration
(The y at the end is to run the resulting function on the input)
Explanation:
L&bX1.Bbyslb
L               def y(b):
 &b             If b is 0, return 0. This is returned as an int, but will be cast
                to a string later.
          lb    Take the log of b
         s      Floor
        y       Call y recursively
   X1           Insert at position 1 into
     .Bb        Convert b to binary.

SQF, 110
Recursive function:
f={params[["i",0],["l",[]]];if(i<1)exitWith{[0]};while{i>1}do{l=[i%2]+l;i=floor(i/2)};[1]+([count l]call f)+l}

Call as: [NUMBER] call f
 Note this doesn't actually work for 87654321 or other large numbers due to a bug in the ArmA engine. Although it will probably be fixed soon, and should work according to spec.
(This Ticket Here)

PHP, 116 114 bytes
<?$f=function($i)use(&$f){$b=decbin($i);return!$b?0:preg_replace('/^1/',1 .$f(~~log10($b)),$b);};echo$f($argv[1]);

Provide the number as the first argument.
Update:

Saved a byte by replacing strlen($b)-1 with ~~log10($b) (finally understood why everybody else was using logarithm) and another by concatenating differently.

Ruby, 38 bytes
Very similar to Neil's JavaScript answer.
f=->n{("%b"%n).sub(/1\K/){f[$'.size]}}

See it on repl.it: https://repl.it/CnhQ

Java 8 (Full Program), 257 249 bytes
interface M{static void main(String[]a)throws Exception{int i=0,j;while((j=System.in.read())>10)i=i*10+j-48;System.out.print(L(i));}static String L(int i){if(i==0)return "0";String s=Integer.toString(i,2);return "1"+L(s.length()-1)+s.substring(1);}}

Readable Version w/ Explanation (It's mostly just recursion):
interface M {
    static void main(String[]a) throws Exception { // Using Exception is unadvised in real coding, but this is Code Gold
        int i = 0, j; // i stores the input; j is a temporary variable
        while ((j = System.in.read()) > 10) // Read the input to j and stop if it is a newline. Technically this stops for tabulators as well, but we shouldn't encounter any of those...
            i = i * 10 + j - 48; // Looping this step eventually reads the whole number in from System.in without using a reader (those take up a lot of bytes)
        System.out.print(L(i)); // Make a method call
    }

    static String L(int i) { // This gets the actual Levenshtein Code
        if (i == 0)
            return "0"; // The program gets a StackOverflowException without this part
        String s = Integer.toString(i, 2); // Shorter than toBinaryString
        return "1" + L(s.length() - 1) + s.substring(1); // Write in the first character (which is always a one), followed by the next L-code, followed by the rest of the binary string
    }
}

EDIT 1: Saved 8 bytes: The first character of the binary string is always 1; therefore, rather than using s.charAt(0), a better option is simply "1".

Husk, 14 bytes
?ö:1Ṡ+o₀LtḋΘøI

Try it online!
Uses a simple recursive approach. (Dennis's double recursion is insane.)

Nice! I tried answering this challenge myself but had trouble with the inference.

@LegionMammal978 Somehow making a [0] list was difficult. :D

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


text:
Pretty Smooth Moves
In arithmetic, an n-smooth number, where n is a given prime number, is mathematically defined as a positive integer that has no prime factors greater than n. For example, 42 is 7-smooth because all its prime factors are less than or equal to 7, but 44 is not 7-smooth because it also has 11 as a prime factor.
Define a pretty smooth number as a number with no prime factors greater than its own square root. Thus, the list of pretty smooth numbers can be formulated as follows:

(EDITED!) 1 is a pretty smooth number, due to its complete lack of any prime factors. (Note that in the original version of this question, 1 was erroneously excluded from the list, so if you exclude it from your outputs you won't be marked wrong.)
Between 4 (= 22) and 8, the pretty smooth numbers are 2-smooth, meaning they have 2 as their only prime factor.
Between 9 (= 32) and 24, the pretty smooth numbers are 3-smooth, and can have 2s and 3s in their prime factorizations.
Between 25 (= 52) and 48, the pretty smooth numbers are 5-smooth, and can have 2s, 3s, and 5s in their prime factorizations.
And so on, upgrading the criteria every time the square of the next prime number is reached.

The list of pretty smooth numbers is fixed, and begins as follows: 1, 4, 8, 9, 12, 16, 18, 24, 25, ...
Your challenge is to write code that will output all pretty smooth numbers up to and including 10,000 (= 1002). There must be at least one separator (it doesn't matter what kind -- space, comma, newline, anything) between each number in the list and the next, but it is completely irrelevant what character is used.
As per usual, lowest byte count wins -- obviously, simply outputting the list isn't going to be too beneficial to you here. Good luck!

Why is 1 not pretty smooth?

Can we output the list in reverse order?

OEIS A048098 (includes extra 1)

@Mego "There are no pretty smooth numbers less than 4." is pretty clear. Not necessarily obvious, but definitely clear.

@viraptor It is voted as not clear not because it wasn't stated that 1 is not smooth, but because your definition and your exclusion statement contradict each other.

Sorry! This was a complete mistake, and "1" should indeed have been listed as pretty smooth. If anyone outputs the list according to the original criteria (i.e., excluding 1 from the list), they won't be marked wrong, but it would seem to me that including the 1 will cut down on answer length.

@A.Mirabeau You accepted my answer, but it is not the winning answer by the challenge criteria - muddyfish's Pyke answer has the same length, and it was posted nearly 12 hours before mine, so it should be the winner.

Actually, 11 bytes
4╤R`;yM²≤`░

Try it online!
Does not include 1.
Explanation:
4╤R`;yM²≤`░
4╤R          range(10**4)
   `;yM²≤`░  filter: take values where
    ;yM²       the square of the largest prime factor
        ≤      is less than or equal to the value

Jelly, 12 bytes
Æf>½S
³²ḊÇÐḟ

Try it online!
How it works
³²ḊÇÐḟ  Main link. No arguments.

³       Yield 100.
 ²      Square it to yield 10,000.
  Ḋ     Dequeue; yield [2, ..., 10,000].
   ÇÐḟ  Filter-false; keep elements for which the helper link returns 0.

Æf>½S   Helper link. Argument: n

Æf      Compute the prime factorization of n.
  >½    Compare the prime factors with the square root of n.
    S   Sum; add the resulting Booleans.

Brachylog, 21 19 bytes
1 byte thanks to Fatalize, for inspiration of another 1 byte.
100^:4reP$ph^<=P@w\

Try it online!
Takes about 6 seconds here.
100^:4reP$ph^<=P@w\
100                      100
   ^                     squared
    :4                   [10000,4]
      r                  [4,10000]
       eP                P is an integer in that interval (choice point),
        P$ph^<=P         P, prime factorized (from biggest to smallest),
                         take the first element, squared, is less than
                         or equal to P
               P@w       Write P with a newline,
                  \      Backtrack to the last choice point and make
                         a different choice until there is no more
                         choice and the program halts.

Previous 21-byte solution
100^:4reP'($pe^>P)@w\

Try it online!
Takes about 6 seconds here.
100^:4reP'($pe^>P)@w\
100                      100
   ^                     squared
    :4                   [10000,4]
      r                  [4,10000]
       eP                P is an integer in that interval (choice point),
        P'(      )       The following about P cannot be proved:
           $pe               one of its prime factor
              ^              squared
               >P            is greater than P
                  @w     Write P with a newline,
                    \    Backtrack to the last choice point and make
                         a different choice until there is no more
                         choice and the program halts.

100^:4reP$pot^<=P@w\ is one byte shorter, though less elegant.

@Fatalize Thanks, I golfed off another byte

Haskell, 53 bytes
r=[1..10^4]
[n|n<-r,product[x|x<-r,x*x<=n]^n`mod`n<1]

I don't have time to golf this now, but I want to illustrate a method for testing if n is pretty smooth: Multiply the numbers from 1 to sqrt(n) (i.e. compute a factorial), raise the product to a high power, and check if the result is a multiple of n.
Change to r=[2..10^4] if 1 should not be output.

Not that it's any golfier, but I'm pretty sure the cube suffices (8 requires it).

Pyth, 16 15 bytes
1 byte thanks to Jakube.
tf!f>*YYTPTS^T4

Try it online!
tf!f>*YYTPTS^T4
             T   10
            ^T4  10000
           S^T4  [1,2,3,...,10000]
 f               filter for elements as T for
                 which the following is truthy:
         PT          prime factorization of T
   f                 filter for factor as Y:
     *YY                 Y*Y
    >   T                greater than T ?
  !                  logical negation
t                remove the first one (1)

Surely Pyth has a square function? So you can replace *dd  with that function?

@ConorO'Brien Nope, Pyth has not a square function.

that seems like kind of an oversight

05AB1E, 16 14 13 bytes
4°L¦vyf¤yt›_—

Explanation
4°L¦v             # for each y in range 2..10000
      yf¤         # largest prime factor of y
         yt       # square root of y
           ›_     # less than or equal
             —    # if true then print y with newline

Try it online

4° is short for 10000.

@Adnan Thanks! Forgot about that one.

Matlab, 58 57 56 52 48 bytes
for k=1:1e4
if factor(k).^2<=k
disp(k)
end
end

For each number it checks if all factors squared are not larger than the number itself. If yes, displays that number.
Thanks to @Luis Mendo for golfing this approach

Another approach (50 bytes):
n=1:10^4;for k=n
z(k)=max(factor(k))^2>k;end
n(~z)

For each number computes whether its maximum prime factor squared is less than the number itself. Then uses it for indexing.

Your previous approach can be made shorter: for k=4:1e4,if factor(k).^2<=k,disp(k);end;end

SQF, 252 227 220
Standard script format:
#define Q(A,B) for #A from 2 to B do{
Q(i,10000)if([i]call{params["j"];u=sqrt j;a=true;Q(k,u)a=a and((j%k!=0)or(j/k<u)or!([j/k]call{params["x"];q=true;Q(z,sqrt x)q=q and(x%z!=0)};q}))};a})then{systemChat format["%1",i]}}

Include the pre-processor in the compilation chain when calling eg:

execVM "FILENAME.sqf"
call compile preprocessFile "FILENAME.sqf"

This writes to the System Chat log, which is the closest thing SQF has to stdout

C, 113 bytes
#include<stdio.h>
main(a){for(;++a<10001;){int n=2,c=a;for(;n*n<=a;n++)while(c%n<1)c/=n;if(c<2)printf("%d ",a);}}

Ideone it!

Pyke, 13 12 11 bytes
T4^S#DP#X<!

Try it here!
(Link only goes up to 10^3 because 10^4 times out)
T4^S        -  one_range(10^4)
    #DP#X<! - filter_true(V, ^): (as i)
      P     -   factors(i)
       #X<! -  filter_true(V, ^):
        X   -   ^ ** 2
         <! -    not (i < ^)

J, 20 bytes
(#~{:@q:<:%:)2+i.1e4

Result:
   (#~{:@q:<:%:)2+i.1e4
4 8 9 12 16 18 24 25 27 30 32 36 40 45 48 49 50 54 56 60 63 64 70 72 75 80...

Try it online here.

Python 2, 90 bytes
for i in range(4,10001):
 n=2;j=i
 while n*n<=j:
  while i%n<1:i/=n
  n+=1
 if i<2:print j

Ideone it!

R, 97 bytes
b=F;for(j in 1:1e4){for(i in which(!j%%1:j)[-1])if(which(!i%%1:i)[2]==i)b=i<=j^0.5;if(b)print(j)}

ungolfed
b <- F                               #Initializes
for (j in 1:1e4){                    #Loop across integers 1..10^4
    a <- which(!j%%1:j)[-1]          #Finds all factors
    for (i in a)                     #Loop across factors
         b <- which(!i%%1:i)[2]==i   #Tests primeness
         if(b) c <- i<=j^0.5         #If prime, tests smoothness
    if(c) print(j)                   #If biggest prime factor gives smooth
}                                    #result, Prints the number.

Pyth, 12 bytes
g#^ePT2tS^T4

Does not include 1.


text:
Evaluate an expression of ternary operators
Consider a grammar over the alphabet {0, 1, ?, :} defined by the production rule

s → 0 ┃ 1 ┃ 0 ? s : s ┃ 1 ? s : s

Given a string generated from s, parse it as an expression where ?: is right-associative (for example, a?B?X:Y:c?d:e?f:g means a?(B?X:Y):(c?d:(e?f:g))) and evaluate it with the following semantics:
eval(0) = 0
eval(1) = 1
eval(0?a:b) = eval(b)
eval(1?a:b) = eval(a)

If the result is 0, output some fixed value; if the output is 1, output a different fixed value. Specify your chosen output values (e.g. 0/1, or False/True) in your answer.
Test cases
0 -> 0
1 -> 1
0?0:1 -> 1
0?1:0 -> 0
1?0:1 -> 0
1?1:0 -> 1
0?1?0:1:1 -> 1
1?0?1:1:1 -> 1
1?0:1?0:1?1:1 -> 0
1?1?1:0?1?0:0:0:0 -> 1
1?0:1?0?1:1?1:0:1?1?1:1:1?0:1 -> 0
1?1?1:0?0?1:1:0?1:0:1?1?0?0:0:1?1:0:0?1?0:1:1?0:1 -> 1
0?0?1?0?0:1:0?0:0:0?0?1:1:1?0:1:0?0?0?1:0:0?1:1:1?1?0:1:1 -> 0

Rules

You may not use language built-ins that interpret strings as code in some programming language and run it (such as JavaScript/Perl/Ruby/Python’s eval).
That said, your code doesn’t actually have to parse and then evaluate the input string. You can take any approach the achieves equivalent results and doesn’t violate the previous rule.
Your program will be checked against perl -le 'print eval<>'.
The shortest code (in bytes) wins.

How about using language built-ins like eval that interpret strings as $my_language code after changing the string radically?

What about builtins that interpret strings as $some_other_language code?

@Adám That would be disallowed, sorry.

@Mego Hmm, there’s a trivial cheating opportunity there, so I extended the rule to cover all such built-ins.

Would it be valid to just define an operator ?: and consider the input as code?

What do you mean by consider? I don’t see how that wouldn’t violate the first rule, sorry ^^;

I don't quite see what you mean by the second rule then?

I agree that it’s confusing. Peter Taylor was just being pedantic in the sandbox :) It just means “I write ‘parse’ in the second paragraph, but you don’t actually have to construct a parse tree and recurse on it; you can use e.g. regexes instead”.

In the light of Martin's test cases, perhaps it would be simpler to define the grammar as S → T | T ? S : S, T → 0 | 1, removing the need to talk about associativity?

In PHP, can I write the input to a file and include that file (effectively causing it to execute) or is that eval()-ish?

Nope, that’s eval()-ish.

GolfScript, 21 bytes
2/-1%{)2%{0`=@@if}*}/

This outputs 0 or 1. Input is assumed to have a single trailing newline. Using ~ (which evaluates strings) would save a byte:
2/-1%{)2%{~!@@if}*}/

This is based on http://golf.shinh.org/reveal.rb?The+B+Programming+Language/tails_1462638030&gs .

Retina, 23 bytes
r-1=+`0\?.:|1\?(.):.
$1

Try it online! (The first line enables a linefeed-separated test suite.)
Explanation
It's fairly simple actually. The input is reduced to the result by repeatedly (+) evaluating ternaries that contain only literals. To make sure this is done right-associatively, we look for matches from right to left (r) and replace only the last match we find (-1=).
The regex itself either matches 0\?.: and removes it (leaving only the stuff after :) or 1\?.:. and replaces it with the value after the ?.

If the regex starts from the right then shouldn't you process the 1st match instead of the -1st?

@LeakyNun Unfortunately, I think I reverse the matches before applying the limit.

Haskell, 106 101 100 90 83  bytes
This heavily relies on pattern Haskell's pattern matching capabilities. First of all, we reverse the string such that we can just seach for the first occurence of b:a?x (which would normally read as x?a:b) and replace it with it's value. This automatically provides the right associativity. Here we make use of x:xs pattern. This is what the function f is doing. Then we basically apply f to it's output over and over again, until we have a single number (0 or 1) left.
Thanks @Lynn for 12 bytes!
f(b:':':a:'?':x:l)|x>'0'=a:l|1>0=b:l
f(x:l)=x:f l
f x=x
until((<2).length)f.reverse

Brainfuck, 82 64 63 bytes
+
[
  ,>>,>
  +++++++[<---<<-[------>>]<-]
  <<
  [
    ->[<++>[+]]
  ]
  +>[>>]
  <<<-
]
<.

The output is \xff for 0 and \x00 for 1. The brainfuck implementation must allow going to the left of the starting cell.
This uses essentially the same approach as xsot's Python answer, but the branching is probably harder to follow compared with my initial 82-byte submission:
-
[
  +
  [
    ->,,>+++++++[<--------->-]
    <[<++>[+]]
    <
  ]
  ,->,>+++++++[<[-------<]>>-->-]
  <[<]
  <
]
>>.

(For this solution, the output is \xfe for 0 and \xff for 1, and wider compatibility is achieved when the input ends with a newline.)
If you can't be bothered to analyse xsot's solution, the idea is this: Proceed from left to right. If you see 1? then greedily discard it. If you see 0? then discard everything between that and the corresponding :. When ? does not appear as the second character, stop looping and print the first character of the remaining string.
So, the 82-byte solution actually mirrors that scheme pretty closely. The inner loop handles 0?, just like xsot's inner loop. Some care is taken in order to enter the main loop without checking any input characters; i.e., we want to check whether the second character is ? just once at the end of the main loop, and not also at the beginning before entering the main loop.
The 63-byte solution essentially combines the inner and outer loops into one, which I suspected was possible given the similarity between those loops. The memory layout in the main loop could be described as:
[s] d c

where [x] means current cell -- the s starts as a dummy nonzero value that just indicates we are still looping, and is immediately overwritten with an input character (either 0 or 1). The d cell holds the (negative) depth in case we are in the middle of a 0?, otherwise 0. The c is going to be either ? or : or newline or EOF.
After updating s and c, we handle the 0? case by updating d accordingly and adjusting the pointer, otherwise we use the current value of c as the value of d in the next iteration, or stop if we are done.

Python 2, 76 74 73 72 bytes
a=`id`
for c in input()[::-1]:a=(c+a,a[ord(c)*7%9]+a[4:])[a>'?']
print a

With input as string literal to avoid raw_.
The output is 0 or 1 followed by <built-in function id>.

Haha, I just read your answer for b lang and was about to post an almost identical answer! Here's an additional optimisation: 3>>int(c)

Care to explain how this works? Looks really neat

@WorldSEnder I think it's the type of solution that can be tricky to come up with, but easy to understand once you see it. It runs through the string backwards and repeatedly processes the rightmost conditional, as other solvers have done as well.

That \id`` trick…! Well done :)

Python 2, 89 bytes
s=input()
while'?'<=s[1:]:
 n=s<'1'
 while n:s=s[2:];n+=-(s[1]<'?')|1
 s=s[2:]
print s[0]

Input is taken as a string literal.

Grime, 34 31 bytes
E=d|d\?E.E
e`\1|\1\?_.E|\0\?E._

Prints 1 for truthy inputs and 0 for falsy ones.
Try it online!
The last test case unfortunately runs out of memory on TIO.
Explanation
The right-associativity essentially means that in a?b:c, a is always either 0 or 1, never a longer expression.
I'll just recursively define a pattern that matches a truthy expression like that, and check the input against it.
It's also unnecessary to check that every : is really a :, if the ?s are all checked: there is an equal number of ?s and :s in the input, and if some ? is incorrectly classified as a :, the corresponding : will fail to match, and Grime's matching engine will backtrack.
E=d|d\?E.E
E=                      Define nonterminal E (for "expression") as
  d|                     a digit, OR
    d                    a digit,
     \?                  a literal ?,
       E                 a match of E,
        .                any character (will match a :), and
         E               another match of E.
e`\1|\1\?_.E|\0\?E._
e`                      Match entire input against this pattern (truthy expression):
  \1|                    a literal 1, OR
     \1\?                a literal 1?,
         _               a recursive match of truthy expression,
          .              any character (will match a :), and
           E|            any expression, OR
             \0\?E._     the same, but with 0 in front, and _ and E swapped.

Haskell, 79 71 70 62 60 56 bytes
Edit: Thanks to @Zgarb for 3 bytes and to @nimi for 4 bytes!
e(x:'?':r)|a:_:s<-e r=last$e s:[a:tail(e s)|x>'0']
e x=x

This a recursive approach that somewhat abuses the "some fixed value"-output rule. Edit: Getting rid of the tuples doesn't only save 8 bytes, it also yields a nicer output: "0" or "1".
Ungolfed version:
eval (x:'?':r1) = if x=='1' then (a, r3) else (b, r3)
    where (a,':':r2) = eval r1
          (b, r3)    = eval r2
eval (x:r) = (x,r)

How does it work?
The eval function traverses the implicit tree of the expressions
eval 1?0?0:1:0?1:0 -> eval 1?          :
                             eval 0?0:1 eval 0?1:0

and returns a tuple of the form (result, rest).
The first pattern (x:'?':r1) matches x to '1' and r1 to "0?0:1:0?1:0". Recursively applying eval to r1 evaluates the sub-expression 0?0:1 and returns (0,":0?1:0"). Matching this to the pattern (a,':':r2) yields a=0 and r2=0?1:0. This sub-formula is also recursively evaluated so that b='0' and r3="". Check if x is '1' or '0' and return either (a, r3) or (b, r3).

Nice approach! Would x>'0' work in place of x=='1'?

Thanks, I didn't think of that while dealing with chars.

I think you can also replace ':' by _.

Yes, then the code even works for arbitrary delimiters instead of just :. Thanks again!

Nice! You can replace the if .. then .. else with last$e s:[a:tail(e s)|x>'0'].

Thanks, I wasn't aware of this trick to get rid of the if-statement.

Perl, 32 + 1 (-p flag) = 33 bytes
Full credit to  @Mitch Swartch, as his solution was 14 bytes shorter than mine!
Thanks also to @Neil who suggested a solution 1 byte longer than Mitch.
s/.*\K(0\?..|1\?(.)..)/\2/&&redo

Needs -p flag, as well as -M5.010 or -E to run. For instance :
perl -pE 's/.*\K(0\?..|1\?(.)..)/\2/&&redo' <<< "0
0?0:1
0?1?0:1:1
1?0:1?0?1:1?1:0:1?1?1:1:1?0:1
0?0?1?0?0:1:0?0:0:0?0?1:1:1?0:1:0?0?0?1:0:0?1:1:1?1?0:1:1"

Explanations : It basically reduces the blocks of a?b:c (starting from the end to be sure no ? follows) into b or c depending on the truthness of a, over and over until the string only contains 1 or 0.

Does the - not count towards your score? Hrm. Interesting... Good answer!

@MayorMonty For a 1-liner you can invoke it on the command line using perl -e '<code>' thus adding a p only costs 1 byte perl -pe '<code>'.

@Neil Ahh, that makes sense

Actually you don't have to reverse the string, you can just negative lookahead for a ?, I was able to cut this down to 34 bytes this way.

Here is a 32 + 1: s/.*\K(1\?(.)..|0\?..)/\2/&&redo

@MitchSchwartz and Neil, indeed, it seems pretty obvious now... Thank you both!

JavaScript (ES6), 53 bytes
f=s=>s[1]?f(s.replace(/0\?.:|1\?(.):.(?!\?)/,"$1")):s

Returns 0 or 1 for valid input; hangs for invalid input. Explanation: because reversing a string is awkward in JavaScript, my first 71-byte attempt worked by using a negative lookahead for a ? which would otherwise disturb the associativity:
f=s=>s[1]?f(s.replace(/(.)\?(.):(.)(?!\?)/,(_,a,b,c)=>+a?b:c)):s

Since this was somewhat long I wondered whether I could improve matters by incorporating the decision making into the regexp. As it turned out, it wasn't an immediate success, as it also took 71 bytes:
f=s=>s[1]?f(s.replace(/0\?.:(.)(?!\?)|1\?(.):.(?!\?)/,"$1$2")):s

Then it occurred to me that 0?0: and 0?1: are always no-ops, without concern for associativity. This saved me almost 25%.

Your code block at the top is missing f=. I haven't checked if your byte count is taking it into account or not.

@PatrickRoberts I'm forever doing that, because I copy from the log, which only shows the result of the assignment (which is enough for nonrecursive functions of course).

@Neil you can copy from log input instead of output

@MarsUltor The log input includes the prompt, which I have to then remember to exclude. This is an awkward extra step for non-recursive functions, which is why I copy from the output by default.

Python 3, 93 69 bytes
def f(s):z=s.pop;r=z(0);return s and':'<z(0)and(f(s),f(s))[r<'1']or r

Input is the string as a list of characters, output is either "0" or "1"
>>>f(list("0?0:1"))
<<<"1"

Ungolfed version:
def parse(s):
    predicate = s.pop(0)
    if s and s.pop(0) == '?':
        left, right = parse(s), parse(s)
        if predicate == '0':
            return right
        return left
    return predicate

Another try, but with considerably more bytes:
i=input()[::-1]
a=[i[0]]
for o,z in zip(i[1::2],i[2::2]):a+=[z]if o<'?' else[[a.pop(),a.pop()][z>'0']]
print(a[0])

Your answer may be a function — you can remove the second line.

This is clearly untested, as it doesn't pass the test cases, and the ungolfed version gives a runtime error. Your basic idea is good though. With some adjustments I get 68 in Python 2 and 69 in Python 3.

Well I think it makes more sense for me to give you the answer than to edit it into my own (since I wasn't thinking about this kind of approach before I saw your answer) or sit around waiting while your answer is buggy. Here is the 68 I mentioned def f(s):x=s.pop(0);return[]<s<s.pop(0)>'>'and(f(s),f(s))[x<'1']or x, and for Python 3 with small edit distance to yours, there is def f(s):z=s.pop;r=z(0);return s and':'<z(0)and(f(s),f(s))[r<'1']or r .

Thanks @MitchSchwartz, pretty much parse from right, instead of left, gotcha

Otherway, left instead of right, ~~~

SED, 75 74 68 (40 + 1 for -r) 41
:
s,(.*)1\?(.):.,\1\2,
s,(.*)0\?.:,\1,
t

You can probably cut this down using @MitchSchwartz's trick in his comment, although you may have to use (.*) and add an extra replacement term.

@Neil, you could be right, but I can't figure out how to make it work.

I wrote it in chat, since formatting in a comment might be confusing: http://chat.stackexchange.com/transcript/message/31709640#31709640

@MitchSchwartz Heh, blank labels work? But I think you meant \3 instead of \2. Also, you can join the lines with ; to get :;s/(.*)(1\?(.):.|0\?.:)/\1\3/;t.

@Neil I had \3 so that means I accidentally copied a previous version. I know about semicolons. But yuck, why would you want to use semicolons.

@MitchSchwartz Because they work in comments!

@Neil It was rhetorical.

Bash + GNU utilities, 42
rev|sed -r ':
s/(.):.\?0|.:(.)\?1/\1\2/
t'

Similar idea to most of the other pattern-matching answers.
Ideone.

You don't need to capture the first character in the 0 case, that saves you 5 bytes.


text:
All in all it's just, uh, another trick in code golf
The purpose of this challenge is to produce an ASCII version of the cover of this great album by the rock band Pink Floyd.
The brick junctions are made of characters _ and |. Bricks have width 7 and height 2 characters, excluding junctions. So the basic unit, including the junctions, is:
_________
|       |
|       |
_________

Each row of bricks is offset by half a brick width (4 chars) with respect to the previous row:
________________________________________
  |       |       |       |       |
  |       |       |       |       |
________________________________________
      |       |       |       |       |
      |       |       |       |       |
________________________________________
  |       |       |       |       |
  |       |       |       |       |

The wall is parameterized as follows. All parameters are measured in chars including junctions:

Horizontal offset of first row, F. This is the distance between the left margin and the first vertical junction of the upmost row. (Remember also the half-brick relative offset between rows). Its possible values are 0, 1, ..., 7.
Total width, W. This includes junctions. Its value is a positive integer.
Total height, H. This includes junctions. Its value is a positive integer.

The top of the wall always coincides with the top of a row. The bottom may be ragged (if the total height is not a multiple of 3). For example, here's the output for 6, 44, 11:
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |
  |       |       |       |       |       |
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |

and a visual explanation of parameters:
          F=6
         ......
     .   ____________________________________________
     .         |       |       |       |       |
     .         |       |       |       |       |
     .   ____________________________________________
     .     |       |       |       |       |       |
H=11 .     |       |       |       |       |       |
     .   ____________________________________________
     .         |       |       |       |       |
     .         |       |       |       |       |
     .   ____________________________________________
     .     |       |       |       |       |       |

         ............................................
                             W=44

Additional rules
You may provide a program or a function.
Input format is flexible as usual. Output may be through STDOUT or an argument returned by a function. In this case it may be a string with newlines or an array of strings.
Trailing spaces or newlines are allowed.
Shortest code in bytes wins.
Test cases
Inputs are in the order given above, that is: horizontal offset of first row, total width, total height.
6, 44, 11:
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |
  |       |       |       |       |       |
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |

2, 20, 10:
____________________
  |       |       |
  |       |       |
____________________
      |       |
      |       |
____________________
  |       |       |
  |       |       |
____________________

1, 1, 1:
_

1, 2, 3:
__
 |
 |

3, 80, 21:
________________________________________________________________________________
   |       |       |       |       |       |       |       |       |       |
   |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
       |       |       |       |       |       |       |       |       |       |
       |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
   |       |       |       |       |       |       |       |       |       |
   |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
       |       |       |       |       |       |       |       |       |       |
       |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
   |       |       |       |       |       |       |       |       |       |
   |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
       |       |       |       |       |       |       |       |       |       |
       |       |       |       |       |       |       |       |       |       |
________________________________________________________________________________
   |       |       |       |       |       |       |       |       |       |
   |       |       |       |       |       |       |       |       |       |

You got me with the clickbait in the hnq

@RohanJhunjhunwala Sounds about right

Thank you for matching the number of syllables in the lyrics... you wouldn't believe how many people try to spin-off a song and get the syllabification wrong, it drives me nuts!

@ChrisCirefice Haha, thanks! The title was an important part of this challenge

Nice Challenge! Could I suggest a title update, tho? It can be a bit more concise as "All in all it's just another trick in the code"

@AJFaraday Thanks! I like your proposal too, but I've grown fond of the current title :-)

@LuisMendo Fair play, good challenge, tho. It's really taking off

Pyth, 43 27 bytes
I need to golf it heavily... the score is too shameful.
AQVE<*H?%N3X*8d+G*4/N3\|\_H

Try it online already.
Input format
6,44
11

Output format
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |
  |       |       |       |       |       |
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |

Explanation
AQVE<*H?%N3X*8d+G*4/N3\|\_H   First two inputs as list in Q,
                              third input as E.

AQ                            Assign G to the first item in Q
                              and H to the second item in Q.
  VE                          For N from 0 to E-1:
                   /N3            N floor-div 3.
                                    if N gives a remainder of 3 or 4 or 5
                                    when divided by 6, this will be odd;
                                    otherwise, this will be even.
                 *4               Multiply by 4.
                                    if the above is odd, this will leave
                                    a remainder of 4 when divided by 8;
                                    otherwise, the remainder would be 0.
               +G                 Add G (as an offset).
           X*8d       \|          In the string "        " (*8d),
                                  replace (X) the character with the
                                  index above with "|" (modular indexing,
                                  hence the manipulation above).
       ?%N3             \_        If N%3 is non-zero, use the above;
                                  otherwise, use "_".
     *H                           The above repeated H times.
    <                     H       Take the first H characters of above.
                                  Implicitly print with newline.

looks like you win

C, 86 85 83 82 bytes
3 bytes saved thanks to Lynn.
1 byte saved thanks to charlie.
i;f(o,w,h){++w;for(i=0;++i<w*h;)putchar(i%w?i/w%3?i%w+i/w/3*4+~o&7?32:124:95:10);}

for(i=0;++i<w*h;) or if i is made local (param trick): for(;++i<w*h;)

replace i; by i=1; and save one more byte in the for loop.

for(i=1;i<w*h;++i) -> for(i=0;++i<w*h;) saves 1

@xryl669 That's not valid, functions must be reusable.

@Yay295 I credited charlie with that, since he posted it 7 hours earlier.

Suggest for(i=!++w instead of ++w;for(i=0

C, 92 bytes
b(f,w,h,y,x){for(y=0;y<h;y++,puts(""))for(x=0;x<w;x++)putchar(y%3?(x+y/3*4-f)%8?32:124:95);}

Invoke as b(F, W, H).

Only 92 bytes in C? That's incredible.

85 bytes

Perl, 63 bytes
#!perl -nl
$y+=print+map$y%3?$_++-$`&7?$":'|':_,($y%6&4)x$&for/ \d+/..$'

Counting the shebang as 2, input is taken from stdin, whitespace separated.
Sample Usage
$ echo 2 20 10 | perl bricks.pl
____________________
  |       |       |
  |       |       |
____________________
      |       |
      |       |
____________________
  |       |       |
  |       |       |
____________________

Haskell, 83 bytes
q s="_":[s,s]
(f!w)h=take h$cycle$take w.drop(7-f).cycle<$>q"       |"++q"   |    "

This defines a ternary infix function ! which returns a list of strings. Usage example:
*Main> putStrLn $ unlines $ (3!14) 7
______________
   |       |
   |       |
______________
       |
       |
______________

How it works:
            q"       |"++q"   |    "  -- build a list of 6 strings
                                      --   1:     "_"
                                      --   2:     "       |"
                                      --   3:     "       |"
                                      --   4:     "_"
                                      --   5:     "   |    "
                                      --   6:     "   |    "
         <$>                          -- for each of the strings
     take w.drop(7-f).cycle           -- repeat infinitely, drop the first 7-f chars
                                      --    and take the next w chars
  cycle                               -- infinitely repeat the resulting list
take h                                -- and take the first h elements

Answers like this make me want to learn this language.

I thought of Haskell when reading the problem description.  "Repeat infinitely" is a really neat feature to have.

JavaScript (ES6), 96 95 bytes

g=
(f,w,h)=>[...Array(h)].map((_,i)=>(i%3?`       |`:`_`).repeat(w+7).substr(f^7^i%6&4,w)).join`
`
;

<input id=f type=number min=0 max=7 placeholder=Offset><input id=w type=number min=0 placeholder=Width><input id=h type=number min=0 placeholder=Height>

Explanation: Creates a string of either the repeating 7 spaces plus | pattern or just repeated _s, but at least long enough to be able to extract the w characters required for each row. The first three rows start at position f^7 and then the next three rows start at position f^3, so I achieve this by toggling bit 2 of f on every third row using the opposite bit 2 on the last two rows of each block of 6 for a saving of 1 byte.

Python 2, 93 88 bytes
2nd indentation level is tab Saving some bytes thanks to Leaky Nun and some own modifications, also now correct offset:
def f(F,W,H):
 for h in range(H):print["_"*W,((("|"+7*" ")*W)[8-F+h%6/3*4:])[:W]][h%3>0]

previous code:
def f(F,W,H,x="|"+7*" "):
 for h in range(H):
    print ["_"*W,(x[F+4*(h%6>3):]+x*W)[:W]][h%3>0]

Same length as unnamed lambda:
lambda F,W,H,x="|"+7*" ":"\n".join(["_"*W,(x[F+4*(h%6>3):]+x*W)[:W]][h%3>0]for h in range(H))

F,W,H=input()

remove the whitespace after print

use h/3%2*4 or h%6/3*4 instead of 4*(h%6>3)

You don't need the second indentation level. Just put the print statement at the same line as the for statement

"|       " is shorter than ("|"+7*" ") if I count correctly

I insist that it is shorter to use F,W,H=input()

I used variations of the same formulas in my QBasic answer (before peeking, of course).  The rest of the logic is pretty different, though.  Maybe some of the suggestions to optimize this answer will translate to mine.

((7*" "+"|")*W)[F^7^h%6&4:] saves you 2 bytes.

MATL, 42 36 33 bytes
:-Q'_ | |'[DClCl]Y"8et4YShwi:3$)!

Input format is: nCols, offset, nRows
Try it Online
The approach here is that we setup a "template" which we then index into by using the row indices ([1 2 ... nRows]) and column indices  shifted by the first input ([1 2 ... nCols] - shift). Thanks to MATL's modular indexing, it will automatically result in a tiled output. As a side-note, to save some space, technically I work with a transposed version of the template and then just take a transpose (!) at the end.
The template is this:
________
       |
       |
________
  |
  |

Nice use of run-length coding to generate the pattern

QBasic, 121 109 bytes
(Tested on QB64)
Thanks to @DLosc for golfing my IF statement with a mathematical equivalent.  That was worth 12 bytes.
General Method:
Loop through each cell one at a time and determine whether it should be a _,  , or | depending on its location.  MOD statements and boolean logic are used to determine brick boundaries and how much to stagger the bricks.
Code:
INPUT F,W,H
FOR y=0TO H-1:FOR x=0TO W-1
?CHR$((y MOD 3>0)*(((x-(y MOD 6>3)*4)MOD 8=F)*92+63)+95);
NEXT:?:NEXT

Usage Note:
QBasic expects input to be numbers separated by commas.

Using math instead of IF/THEN adds even more parentheses but saves 12 bytes: ?CHR$((y MOD 3>0)*(((x-(y MOD 6>3)*4)MOD 8=F)*92+63)+95);

Thanks for the comment.  In the back of my head I had considered exploring math, but didn't.  I did something sort of similar to this to color an image in in a recent submission, but the implementation I used didn't have a MOD operator.

Java, 149, 147, 146, 143 bytes
Golfed:
String f(int o,int w,int h){String s="";for(int y=0,x;y<h;++y){for(x=0;x<w;++x){s+=y%3>0?(x-o+(y-1)/3%2*4)%8==0?'|':' ':'_';}s+='\n';}return s;}

Ungolfed:
public class AllInAllItsJustUhAnotherTrickInCodeGolf {

  public static void main(String[] args) {
    int offset = 6;
    int width = 44;
    int height = 11;
    System.out.println(new AllInAllItsJustUhAnotherTrickInCodeGolf()
        .f(offset, width, height));
  }

  // Begin golf
  String f(int o, int w, int h) {
    String s = "";
    for (int y = 0, x; y < h; ++y) {
      for (x = 0; x < w; ++x) {
        s += y % 3 > 0 ? (x - o + (y - 1) / 3 % 2 * 4) % 8 == 0 ? '|' : ' ' : '_';
      }
      s += '\n';
    }
    return s;
  }
  // End golf

}

Maybe you could switch the order of the ternary by comparing to > 0 which could save two characters. And of course you can combine the declarations to int y=0,x.

As being said by Frozn, you can remove int  before the x and use int y=0,x in the first for-loop instead to save 2 bytes. Also, currently your can change y%3==0 to y%3<1. (This isn't possible for ...%8==0 to ...&8<1 though, since your operation could return a negative number.)

Done and done. You are correct, that second modulo can return negative and it did during debugging when I originally wrote this function.

Not sure how we missed this, but you can remove the spaces at your parameters for -2 bytes.. Alternatively, using int...o as parameter and changing w to o[1], h to o[2] and o to o[0] is -3 bytes instead.

Julia: 150 128 116 108 107 bytes
# in codegolf.jl
r=repmat;b=r([' '],6,8);b[[1,4],:]='_';b[[2,3,23,24]]='|';b=r(b,h,w)[1:h,o+=1:o+w];b[:,end]=10;print(b'...)

to run with arguments: julia -e 'o=2;h=18;w=40;include("codegolf.jl")'
If you feel calling from bash is cheating and you want a function inside the interpreter, then the function version is 117 bytes :)
f(o,h,w)=(r=repmat;b=r([' '],6,8);b[[1,4],:]='_';b[[2,3,23,24]]='|';b=r(b,h,w)[1:h,o+=1:o+w];b[:,end]=10;print(b'...))

demo
(Thanks, @glen-o for the extra byte-saving tip!)

Welcome to PPCG! Nice to see you also here!

Note that inputs should be taken explicitly, i.e. you need some kind of input statement for those three variables. Or you can use a function that takes them as arguments and outputs or displays the result. When you are done, you may want to post an online demo using Try it online!

Also, it appears you have interpreted h and w in bricks, not in chars

ah. yes I did! :p

that actually makes it slightly easier! :D

You can save a few characters by using repmat instead of ones (repmat([32],6,8)), and then renaming repmat to shave another character (g=repmat;b=g([32],6,8) and later b=g(b,h,w)[1:h,o+1:o+w+1]). Then replace reinterpret with map. By my count, you'll save 9 bytes between these changes.

Actually it saves a lot more, since the Int32 requirement also disappears with map, and this also allows me to use repmat twice (it throws an error with Int32)! I can't believe I didn't map from the beginning (I guess I was stuck thinking of Char as a Type rather than also as a 'constructor'). Thanks, nice catch! :D

... or ... you could just print a character array directly ... d'oh!

Ruby, 72 66 bytes
->f,w,h{h.times{|i|puts i%3<1??_*w:((?|+' '*7)*w)[8-f+i%6/4*4,w]}}

Thanks @Value Ink for 6 bytes!
Simple string multiplication and slicing.
Works in Ruby 2.3.0 (Ideone's version 2.1 threw syntax error).

Use i%6/4*4 instead of (i%6>3?4:0) and use ?_ instead of '_', ?| instead of '|'.

Thank you. I forgot about ? single char trick, and the "math" part is really impressive!

I think ((' '*7+?|)*w)[f^7^i%6&4,w] saves you two bytes.

Thank you @Neil. I'll edit the code... as soon as I understand how your suggestion works :)

Dyalog APL, 29 bytes
↑⎕⍴⎕⍴¨a,4⌽¨a←'_',2⍴⊂⌽⎕⌽¯8↑'|'
tests:
6 44 11,
2 20 10,
1 1 1,
1 2 3,
3 80 21
⎕ is evaluated input; as the expression executes from right to left, it prompts for F, W, and H in that order
¯8↑'|' is '       |'
⎕⌽ is rotate, it chops F chars from the front and puts them at the end of the string
the other ⌽ means reverse
'_',2⍴⊂ creates a 3-tuple of '_' followed by two separate copies of the string so far
a,4⌽¨a← append the 4-rotation of everything so far, we end up with a 6-tuple
⎕⍴¨ reshape each element to the width
⎕⍴ reshape to the height
↑ mix vector of vectors into a matrix

JavaScript, 172 168 165 157 147 142 137 bytes
(O,W,H)=>{t='_'.repeat(W),x='|       '.repeat(W),f=t+`
`;for(i=0;++i<H;)f+=(!(i%3)?t:(i%6)>3?x.substr(O,W):x.substr(8-O,W))+`
`;return f}

N = (O,W,H)=>{t='_'.repeat(W),x='|       '.repeat(W),f=t+`
`;for(i=0;++i<H;)f+=(!(i%3)?t:(i%6)>3?x.substr(O,W):x.substr(8-O,W))+`
`;return f}

let test_data = [[6,44,11],
                 [2,20,10],
                 [1,1,1],
                 [1,2,3],
                 [3,80,21]];

for (test of test_data)
    console.log(N(...test));

Why not use s.repeat(w) instead of Array(w).fill(s).join\``?

@Neil: Good idea, but I thought of something better.

and then realized your solution is better than I thought. Thanks!

05AB1E, 25 24 23 bytes
'_'|7úD)³∍ε73N3÷è¹-._²∍

-1 byte thanks to @Grimmy.
Inputs in the order \$\text{offset}, \text{width}, \text{height}\$.
Output as a list of string-lines.
Try it online or verify all test cases.
Explanation:
'_           '# Push "_"
'|           '# Push "|"
  7ú          # Pad 7 leading spaces: "       |"
    D         # Duplicate it
     )        # Wrap all three values on the stack into a list
³∍            # Extend this list to the (third) input-height amount of lines
              #  i.e. height=7 → ["_","       |","       |","_","       |","       |","_"]
ε             # Map over each line:
   N          #  Push the (0-based) map-index
    3÷        #  Integer-divide it by 3
 73   è       #  Index it into 73 (0-based and with wraparound)
              #   i.e. indices=[0,1,2,3,4,5,6,7,...] → [7,7,7,3,3,3,7,7,...]
       ¹+     #  Subtract the (first) input-offset
              #   i.e. offset=6 → [-3,-3,-3,1,1,1,-3,-3,...]
         ._   #  Rotate the string that many times towards the left
              #   i.e. ["_","       |","       |","_","       |","       |","_"] and
              #     [-3,-3,-3,1,1,1,-3] → ["_","      | ","      | ","_","  |     ","  |     ","_"]
           ²∍ #  After this inner loop: push the (second) input-width
              #  Extend/shorten the line to a size equal to the (second) input-width
              #   i.e. width=5 and line="   |    " → "   | "
              #   i.e. width=20 and line="   |    " → "   |       |       |"
              #   i.e. width=5 and line="_" → "_____"
              #   i.e. width=20 and line="_" → "____________________"
              # (after which the list of string-lines is output implicitly as result)

73N3÷è could alternatively be ₃€ÐÍNè for the same byte-count:
Try it online or verify all test cases.
 ₃            #  Push builtin 95
  €Ð          #  Triplicate each digit: [9,9,9,5,5,5]
    Í         #  Decrease each by 2: [7,7,7,3,3,3]
     Nè       #  Index the (0-based) map-index into this (0-based and with wraparound)

I had to go to great lengths to golf just one byte off this. (input order is the reverse of what you use)

@Grimmy Oh, very nice. I was trying to figure out how to use implicit input, but couldn't really figure it out. Smart way to using the second input implicitly in the first iteration, since it's irrelevant for the rotation of the "_" anyway. And also smart of using ._ with the bitwise-NOT ±, since that one can be either integer,string or string,integer as arguments, whereas the ƒÁ} I used has to be string,integer! You weren't kidding when you said you went to great lengths for that -1! ;D

@Grimmy I just read that the output may be a list of string-lines, so I guess we both had a 24-byter. ;)

In that case, here's 23 (alt)

@Grimmy Nice one! I especially like that alternative with the ₃€ÐÍ. :)

Actually, 44 43 40 bytes
This is an Actually port of the algorithm in Neil's JS answer. Golfing suggestions welcome. Try it online!
╗╝r⌠;6(%4&╜7^^╛'|7" "*+*t╛@H╛'_*3(%YI⌡Mi

Ungolfing:
          Takes implicit input in the order h, w, f.
╗╝        Save f to register 0. Save w to register 1.
r⌠...⌡M   Map over range [0..h-1]. Call this variable i.
  ;         Duplicate i
  6(%       i%6...
  4&        ...&4
  ╜7^^      ...^i^7. Call it c.
  ╛         Push w.
  '|7" "*+  The string "       |"
  *t╛@H     (("       |" * w)[c:])[:w]
  ╛'_*      Push "_" * w
  3(%       Push 3, move duplicate i to TOS, mod.
  YI        If not i%3, take "_"*w, else (("       |" * w)[c:])[:w]
            Function ends here.
i         Flatten the resulting list and print the bricks implicitly.

PowerShell, 101 88 bytes
param($n,$w,$h)0..--$h|%{(('|       '*$w|% S*g(8-$n+4*($_%6-gt3))$w),('_'*$w))[!($_%3)]}

Try it online!

Vyxal, 30 bytes
(n₃[¹\_*,|7\|꘍¹*⁰ǔǔn3ḭ∷[4ǔ]¹Ẏ,

Try it Online!
A big mess.
(                              # (height) times (to make each row)
 n₃[                           # If the iteration is divisible by 3 (flat row) then...
    ¹\_*,                      # (width) underscores
         |                     # Else (part of a brick)...
          7\|꘍                 # Prepend seven spaces to an underscore
              ¹*               # Repeat (width) times
                ⁰ǔǔ            # Cycle by (offset), then cycle once more
                   n3ḭ∷[  ]    # If it's an offset row
                        4ǔ     # Cycle once more
                           ¹Ẏ, # Trim to the correct length and print.

Delphi/Object Pascal, 305, 302, 292 bytes
Full console program that reads 3 parameters.
uses SySutils,Math;var i,q,o,w,h:byte;begin o:=StrToInt(paramstr(1));w:=StrToInt(paramstr(2));h:=StrToInt(paramstr(3));for q:=0to h-1do begin for i:=1to w do if q mod 3=0then Write('_')else if IfThen(Odd(q div 3),((i+o)mod 8),((i-o)mod 8))=1then Write('|')else Write(' ');Writeln('');end end.

ungolfed
uses
  SySutils,
  Math;
var
  i,q,o,w,h:byte;
begin
  o:=StrToInt(paramstr(1));
  w:=StrToInt(paramstr(2));
  h:=StrToInt(paramstr(3));

  for q := 0 to h-1 do
  begin
    for i := 1 to w do
      if q mod 3 = 0  then
        Write('_')
      else
        if IfThen(Odd(q div 3),((i+o)mod 8),((i-o)mod 8)) = 1 then
          Write('|')
        else Write(' ');
    Writeln('');
  end
end.

Sadly, Delphi does not have a ternary operator and it is quite a verbose language.
test case
D:\Test\CodeGolfWall\Win32\Debug>Project1.exe 2 20 10
____________________
  |       |       |
  |       |       |
____________________
      |       |
      |       |
____________________
  |       |       |
  |       |       |
____________________

D:\Test\CodeGolfWall\Win32\Debug>Project1.exe 6 44 11
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |
  |       |       |       |       |       |
____________________________________________
      |       |       |       |       |
      |       |       |       |       |
____________________________________________
  |       |       |       |       |       |

Edit: Could shave of 3 bytes by using byte as type for all variables.
Edit 2: And console applications do not need the program declaration, -10

Bash + Sed, 411 395 381 370 bytes:
F=`printf '_%.s' $(eval echo {1..$2})`;V="       |";(($[($2-$1)/8]>0))&&L=`printf "$V%.s" $(eval echo {1..$[($2-$1)/8]})`||L=;Z=`printf "%$1.s|%s\n" e "$L"`;I=$[($2-(${#Z}-4))/8];(($I>0))&&W=`printf "$V%.s" $(eval echo {1..$I})`||W=;J=${Z:4}$W;for i in `eval echo {1..$[$3/3+1]}`;{ (($[$i%2]<1))&&O+="$F\n$J\n$J\n"||O+="$F\n$Z\n$Z\n";};echo "`echo -e "$O"|sed -n 1,$3p`"

Well, here is my very first answer in Bash, or any shell scripting language for that matter. This is also by far the longest answer here. Takes in a sequence of space-separated command line arguments in the format Offset Width Height. This can probably be a lot shorter than it currently is, so any tips and/or tricks for golfing this down more are appreciated.

Octave 80 76 bytes
% in file codegolf.m
c(6,8)=0;c([1,4],:)=63;c([2,3,23,24])=92;char(repmat(c+32,h,w)(1:h,o+1:o+w))

to run from terminal: octave --eval "o=2;h=18;w=44; codegolf"
(alternatively, if you think the terminal call is cheating :p then an anonymous function implementation takes 86 bytes :)
c(6,8)=0;c([1,4],:)=63;c([2,3,23,24])=92;f=@(o,h,w)char(repmat(c+32,h,w)(1:h,o+1:o+w))

Call f(2,18,44) at the octave interpreter.

JavaScript (ES6),  81 78  77 bytes
Saved 3 bytes thanks to @mypronounismonicareinstate
Takes input as (F, W)(H).
(F,W,x=y=0)=>g=H=>y<H?`
|_ `[x++<W?y%3?(x+~F^y/3<<2)&7?3:1:2:x=+!++y]+g(H):''

Try it online!

Why not (F,W)=>g=.... and take input as (F, W)(H)?

@mypronounismonicareinstate Doing just that would be 1 byte longer. But it does allow to initialize x and y within the arguments of the 1st arrow function and getting rid of the 2nd argument in the recursive call, saving 3 bytes. I guess that's what you had in mind? Thanks!

No, that is not what I had in mind (for some reason I thought that was a byte shorter) :)