text:
ASCII Box rendering
Task
Your task is to write a program that will output ASCII boxes at the locations specified by the input.
Input
You will be given a list of numbers. The format here is a bit flexible, in that you can use any deliminator you want (e.g. 1,2,3,4, 1 2 3 4, [1,2,3,4]). The list is in groups of 4 and specifies the xywh of each box. The width and height of each box will be at least 2. x and width are left-to-right. y and height are top-to-bottom.
Output
Rendering can be thought of as right to left, with the box on the right drawn first, and every box after that is over it. Trailing spaces are allowed, as well as one trailing newline.
How to handle overlapping boxes
The box on the left of the input is the top box, and nothing will overlap it. Every box after it is rendered only in the space that is not contained in a box already and will not replace the border of a already rendered box.
Style
The style of the boxes are fairly standard, with + used for corners, - used for horizontal lines, and | used for vertical lines.
Examples:
(>>> denotes input)
>>>0 0 11 4 7 2 8 4 3 5 8 3
+---------+
|         |
|         |---+
+---------+   |
       |      |
   +---+------+
   |      |
   +------+

>>>0 3 11 4 7 5 8 4 3 8 8 3 4 0 13 5
    +-----------+
    |           |
    |           |
+---------+     |
|         |-----+
|         |---+
+---------+   |
       |      |
   +---+------+
   |      |
   +------+

>>>0 0 2 2
++
++

>>>2 2 5 3 1 1 7 5 0 0 9 7
+-------+
|+-----+|
||+---+||
|||   |||
||+---+||
|+-----+|
+-------+

>>>0 0 3 3 2 0 3 3
+-+-+
| | |
+-+-+

Shouldn't that middle one be 4 0 13 5 rather than 0 4 13 5?

2nd rectangle from bottom in first 2 cases has x=7 (to be consistent with the x=0 rectangles)

Thanks for noticing, I rarely write answers for my questions, and so all this is by hand...

@JAtkin I am sorry, I missed that.

It's fine, I frequently miss stuff when reading as well ;)

APL, 116 bytes
{⎕IO←0⋄K←' '⍴⍨⌽+⌿2 2⍴⌈⌿↑⍵⋄K⊣{x y W H←⍵-⌊.5×⍳4⋄K[Y←y+⍳H;X←x+⍳W]←' '⋄K[Y;A←x+0 W]←'|'⋄K[B←y+0 H;X]←'-'⋄K[B;A]←'+'}¨⌽⍵}

This is a function that takes an array of arrays and returns a character matrix.
Tests:
      t1← (0 0 11 4)(8 2 8 4)(3 5 8 3)
      t2← (0 3 11 4)(8 5 8 4)(3 8 8 3)(4 0 13 5)
      t3← (⊂0 0 2 2)
      t4← (2 2 5 3)(1 1 7 5)(0 0 9 7)
      {⎕IO←0⋄K←' '⍴⍨⌽+⌿2 2⍴⌈⌿↑⍵⋄K⊣{x y W H←⍵-⌊.5×⍳4⋄K[Y←y+⍳H;X←x+⍳W]←' '⋄K[Y;A←x+0 W]←'|'⋄K[B←y+0 H;X]←'-'⋄K[B;A]←'+'}¨⌽⍵} ¨ t1 t2 t3 t4
┌───────────────────┬─────────────────────┬────┬───────────┐
│+---------+        │    +-----------+    │++  │+-------+  │
│|         |        │    |           |    │++  │|+-----+|  │
│|         |----+   │    |           |    │    │||+---+||  │
│+---------+    |   │+---------+     |    │    │|||   |||  │
│        |      |   │|         |-----+    │    │||+---+||  │
│   +----+------+   │|         |----+     │    │|+-----+|  │
│   |      |        │+---------+    |     │    │+-------+  │
│   +------+        │        |      |     │    │           │
│                   │   +----+------+     │    │           │
│                   │   |      |          │    │           │
│                   │   +------+          │    │           │
│                   │                     │    │           │
│                   │                     │    │           │
└───────────────────┴─────────────────────┴────┴───────────┘

Explanation:

⎕IO←0: set the index origin to 0.
Create a matrix of the right size:

⌈⌿↑⍵: find the largest values for x, y, w, and h
+⌿2 2⍴: x+w and y+h
K←' '⍴⍨⌽: make a matrix of x+w*y+h spaces and store it in K.

Draw the boxes into it:

{...}¨⌽⍵: for each of the boxes, in reverse order,

x y W H←⍵-⌊.5×⍳4: assign the coordinates to x, y, W, and H, and subtract 1 from both W and H. (coordinates are exclusive, APL array ranges are inclusive.)
K[Y←y+⍳H;X←x+⍳W]←' ': fill the current box with spaces
K[Y;A←x+0 W]←'|': draw the vertical sides
K[B←y+0 H;X]←'-': draw the horizontal sides
K[B;A]←'+': set the edges to '+'

K⊣: afterwards, return K.

APL is such a strange looking language to an outsider...

ES6, 228 223 217 208 201 198 bytes
Accepts an array of arrays of coordinates and returns a string.
a=>a.reverse().map(([x,y,w,h])=>[...Array(y+h)].map((_,i)=>(s=r[i]||'',r[i]=i<y?s:(s+' '.repeat(x)).slice(0,x)+(c=>c[0]+c[1].repeat(w-2)+c[0])(y-i&&y+h-1-i?'| ':'+-')+s.slice(x+w))),r=[])&&r.join`\n`

Where \n represents a newline character.
Edit: Saved 5 bytes by reversing my conditions. Saved a further 6 bytes by switching from an array of char arrays to an array of strings. Saved a further 9 bytes by introducing a temporary variable. Saved a further 7 bytes by introducing a helper function. Saved a further 3 bytes by undoing a previous saving!

Ruby, 153 143
->n{a=(0..m=3*n.max).map{$b=' '*m}
(*n,x,y,w,h=n
v=w-2
h.times{|i|a[y+i][x,w]=i%~-h<1??++?-*v+?+:?|+' '*v+?|}
)while n[0]
a.delete($b);puts a}

Ungolfed in test program
f=->n{                                #worst case width when x=w=large number, is max input*2+1
  a=(1..m=3*n.max).map{$b=' '*m}      #find m=max value in input, make an a array of 3*m strings of 3*m spaces
  (
    *n,x,y,w,h=n                      #extract x,y,w,h from the end of n, save the rest back to n
    v=w-2                             #internal space in rectangle is w-2
    h.times{|i|                       #for each row
      a[y+i][x,w]=                    #substitute the relevant characters of the relevant lines of a
      i%~-h<1?                        #i%~-h = i%(h-1). This is zero (<1) for first and last lines of the rectangle
      ?+ + ?-*v + ?+ :?| + ' '*v +?|  # +--...--+ or |  ...  | as required
    }
  )while n[0]                         #loop until data exhausted (n[0] becomes falsy as it does not exist)
a.delete($b);puts a}                  #delete blank rows ($b is a global variable) and display

SmileBASIC, 128 125 bytes
DEF B A
WHILE LEN(A)H=POP(A)W=POP(A)-2Y=POP(A)X=POP(A)FOR I=0TO H-1LOCATE X,Y+I?"+|"[M];"- "[M]*W;"+|"[M]M=I<H-2NEXT
WEND
END

Screenshots (cropped)

Explanation
DEF B A 'make a function and add 12 bytes :(
 WHILE LEN(A) 'repeat until array is empty
  H=POP(A):W=POP(A)-2 'get width/height
  Y=POP(A):X=POP(A) 'get x/y
  FOR I=0 TO H-1 'draw one row at a time
   LOCATE X,Y+I 'position the cursor
   PRINT "+|"[M]; 'draw left edge
   PRINT "- "[M]*W; 'draw middle
   PRINT "+|"[M] 'draw right edge
   M=I<H-2
  NEXT
 WEND
END

M stores whether it's on the first/last row of the box (0=+--+, 1=|  |).
On the first pass through the loop, M is 0, and on all others
until the last, it's 1.

This is pretty nice :)

Meta consensus is that you're not allowed to take input from pre-defined variables.

Pyth, 162 145 bytes
J\+K*h.MZm+@d1@d3Q]*h.MZm+@d0@d2QdD:GHb XKHX@KHGb;V_QDlTR@NTVl3Vl2:+l0b+l1H?|qHtl3qH0\-?|qbtl2qb0\|d)):l0l1J:+l0tl2l1J:l0+l1tl3J:+l0tl2+l1tl3J;jK

You can try it here
Output of test suite:
+---------+
|         |
|         |----+
+---------+    |
        |      |
   +----+-+----+
   |      |
   +------+

++
++

+-------+
|+-----+|
||+---+||
|||   |||
||+---+||
|+-----+|
+-------+

+-+-+
| | |
+-+-+

Horrible solution! Just waiting for someone to beat it

Your first example puts an extra + in where the boxes share an edge.


text:
Output all valid classful public unicast IPv4 addresses
IPv4 addresses are 32 bits wide, and thus the size of the address space is 232, or 4,294,967,296.  However, this is only a theoretical upper-bound.  It is not an accurate representation of all the addresses that may actually be used on the public internet.
For the purposes of this challenge, it is assumed that all addressing is classful.  In reality, classful subdivision of address space has been superseded by CIDR (Classless Inter-Domain Routing and VLSM (Variable Length Subnet Masking), but this is ignored for this challenge.
According to the classful address scheme, there are 3 classes:

Class A - 0.0.0.0 to 127.255.255.255 with /8 netmask length
Class B - 128.0.0.0 to 191.255.255.255 with /16 netmask length
Class C - 192.0.0.0 to 223.255.255.255  with /24 netmask length

Classes D (multicast) and E (reserved) are also defined, but these are not used for public unicast addresses.
Each class is subdivided into networks according to the netmask for that class.
Thus 3.0.0.0 is an example of a Class A network.  The netmask length for Class A is 8, so the full address space for this network is 3.0.0.0 to 3.255.255.255.  However, the first address (3.0.0.0) is reserved as the network address and the last address (3.255.255.255) is reserved as the broadcast address for that network.  Thus the actual range of usable addresses is 3.0.0.1 to 3.255.255.254 which is 224 - 2 (= 16,777,214) total addresses.
Similarly, 200.20.30.0 is an example of a Class C network.  The netmask length for Class C is 24, so the full address space for this network is 200.20.30.0 to 200.20.30.255.  Removing the network and broadcast addresses leaves the actual range of usable addresses is 200.20.30.1 to 200.20.30.254 which is 28 - 2 (= 254) total addresses.
There are further limitations on address ranges that may be used for public unicast.  According to RFC 6890, the disallowed ranges are:

0.0.0.0/8 - Local networking
10.0.0.0/8 - Private-Use
100.64.0.0/10 - Shared Address Space
127.0.0.0/8 - Loopback
169.254.0.0/16 - Link Local
172.16.0.0/12- Private-Use
192.0.0.0/24 - IETF Protocol Assignments
192.0.2.0/24 - Reserved for use in documentation
192.88.99.0/24 - 6to4 Relay Anycast
192.168.0.0/16 - Private-Use
198.18.0.0/15 - Benchmarking
198.51.100.0/24 - Reserved for use in documentation
203.0.113.0/24 - Reserved for use in documentation

Note that the above list uses VLSR netmasks to efficiently specify a range.  In all but one cases, the given mask length has specificity is less than or equal to the normal classful mask length for the start of the range.  Thus each of these VLSR ranges is equivalent to one or more classful networks.  E.g. 172.16.0.0/12 is equivalent to the Class B networks 172.16.0.0 to 172.31.0.0 or the address range 172.16.0.0 to 172.31.255.255.
The exception to this rule is the 100.64.0.0/10 VLSR range, which is more specific than the containing 100.0.0.0 Class A range.  Thus 100.0.0.0 will be handled like other Class A ranges with the exception that it has a 4,194,304-address hole in the middle.  The valid addresses in this Class A range will be  100.0.0.0 to 100.63.255.255 and  100.128.0.0 to 100.255.255.254, a total of 224 - 222 - 2 (= 12,582,910) total addresses.
The goal of this challenge is to output all Class A, B and C unicast IPv4 addresses that may be validly assigned to a public internet host (i.e. excluding those detailed above).

No input will be given and should not be expected.

Output may be in any form convenient for your language, e.g. array, list, delimited string.  Addresses must be output in standard dotted decimal format.

Output order does not matter.

Builtins that specifically give the required ranges of addresses are disallowed.  Similarly any methods to dynamically inspect a BGP (or other protocol) routing table for the public internet are disallowed.

The numerically lowest address will be 1.0.0.1 and the numerically highest will be 223.255.255.254.

This challenge is similar to Print out all IPv6 addresses, but because of the restrictions should require non-trivially different implementation.

PowerShell, 648 641 625 bytes
for([uint64]$a=16MB;$a-lt2GB-16mb;$a++){if(($a%16mb)*(($a+1)%16mb)*($a-lt160MB-or$a-gt176MB)*($a-lt1604MB-or$a-ge1608MB)){([ipaddress]$a).IPAddressToString}}
for($a=2GB;$a-lt3GB;$a++){if(($a%64kb)*(($a+1)%64kb)*($a-lt2785152kb-or$a-gt2720mb)*($a-lt2753mb-or$a-gt2754mb)){([ipaddress]$a).IPAddressToString}}
for($a=3221225728;$a-lt3.5GB;$a++){if(($a%256)*(($a+1)%256)*(($a-lt3221225984-or$a-gt3221226240))*(($a-lt3227017984-or$a-gt3151385kb))*(($a-lt3156480kb-or$a-gt3156544kb))*(($a-lt3245184kb-or$a-gt3245312kb))*(($a-lt3247321kb-or$a-gt3325256959))*(($a-lt3405803776-or$a-gt3405804032))){([ipaddress]$a).IPAddressToString}}

Edit 1 -- I've golfed out all remaining powers-of-two operators, which saved an additional 7 bytes.
Edit 2 -- Moved the [uint64] cast to the first declaration of $a which eliminated the other two re-casts which saved 16 bytes.
Three lines, Class A / Class B / Class C. Left as separate lines for readability. ;-)
Two key points for understanding what's going on:

PowerShell has powers-of-two operators KB, MB, GB. For example, 4KB will return 4096 as an int. We leverage that in multiple locations to shave dozens of bytes.
The .NET [ipaddress] class will try to parse a numerical value as an IP address by taking the number's binary representation. We use that constructor with the IPAddressToString argument for output.

By coupling those two things, we're able to just treat the IP addresses as numbers and loop through them with a for() loop. For example, the first loop for Class A subnets goes from 16MB to 2GB-16MB, or from 16777216 to 2130706432. The binary representation of 16777216 is 1000000000000000000000000 or 00000001.00000000.00000000.00000000 if we split it into 8-bit chunks so we can easily see that corresponds to 1.0.0.0 in dotted-decimal notation. Similarly, 2130706432 can be written as 01111111000000000000000000000000 or 01111111.00000000.00000000.00000000 or 127.0.0.0. Each integer, or power-of-two integer, used here can be rewritten as an IP address in this fashion.
So, for each loop iteration, we construct an if() statement to weed out the excluded addresses, by multiplying the individual statements together. Since the first statement in each if is an integer (thanks to the modulo testing), the remaining Boolean values are converted to either 0 or 1 for false/true. If any one of the statements are false, the whole multiplication will turn to 0 and thus be false. Thus, only if all the statements are true, will we output the result of the parsing.
Slightly Ungolfed:
# Class A
for($a=16MB;$a-lt2GB-16mb;$a++){
  $b=($a%16mb)                     # x.0.0.0
  $b*=(($a+1)%16mb)                # x.255.255.255
  $b*=($a-lt160MB-or$a-gt176MB)    # 10.0.0.0/8
  $b*=($a-lt1604MB-or$a-ge1608MB)  # 100.64.0.0/10
  if($b){([ipaddress]::Parse($a)).IPAddressToString}
}

# Class B
for($a=2GB;$a-lt3GB;$a++){
  $b=($a%64kb)                           # x.y.0.0
  $b*=(($a+1)%64kb)                      # x.y.255.255
  $b*=(($a-lt2785152kb-or$a-gt2720mb))  # 169.254.0.0/16
  $b*=(($a-lt2753mb-or$a-gt2754mb))      # 172.16.0.0/12
  if($b){([ipaddress]::Parse($a)).IPAddressToString}
}

# Class C
for($a=3221225728;$a-lt3.5GB;$a++){
  $b=($a%256)                               # x.y.z.0
  $b*=(($a+1)%256)                          # x.y.z.255
  $b*=(($a-lt3221225984-or$a-gt3221226240)) # 192.0.2.0/24
  $b*=(($a-lt3227017984-or$a-gt3151385kb)) # 192.88.99.0/24
  $b*=(($a-lt3156480kb-or$a-gt3156544kb)) # 192.168.0.0/16
  $b*=(($a-lt3245184kb-or$a-gt3245312kb)) # 198.18.0.0/15
  $b*=(($a-lt3247321kb-or$a-gt3325256959)) # 198.51.100.0/24
  $b*=(($a-lt3405803776-or$a-gt3405804032)) # 203.0.113.0/24
  if($b){([ipaddress]::Parse($a)).IPAddressToString}
}

Batch, 1930 1884 1848 1830 bytes
@echo off
for /l %%a in (1,1,9)do call:a1 %%a
for /l %%a in (11,1,99)do call:a1 %%a
for /l %%b in (0,1,63)do call:a2 100 %%b
for /l %%b in (128,1,255)do call:a2 100 %%b
for /l %%a in (101,1,126)do call:a1 %%a
for /l %%a in (128,1,168)do call:b1 %%a
for /l %%b in (0,1,253)do call:b2 169 %%b
call:b2 169 255
call:b1 170
call:b1 171
for /l %%b in (0,1,15)do call:b2 172 %%b
for /l %%b in (32,1,255)do call:b2 172 %%b
for /l %%a in (173,1,191)do call:b1 %%a
call:c3 192 0 1
for /l %%c in (3,1,255)do call:c3 192 0 %%c
for /l %%b in (1,1,87)do call:c2 192 %%b
for /l %%c in (0,1,98)do call:c3 192 88 %%c
for /l %%c in (100,1,255)do call:c3 192 88 %%c
for /l %%b in (89,1,167)do call:c2 192 %%b
for /l %%b in (169,1,255)do call:c2 192 %%b
for /l %%a in (193,1,197)do call:c1 %%a
for /l %%b in (0,1,17)do call:c2 198 %%b
for /l %%b in (20,1,50)do call:c2 198 %%b
for /l %%c in (0,1,99)do call:c3 198 51 %%c
for /l %%c in (101,1,255)do call:c3 198 51 %%c
for /l %%b in (52,1,255)do call:c2 198 %%b
for /l %%a in (199,1,202)do call:c1 %%a
for /l %%c in (0,1,112)do call:c3 203 0 %%c
for /l %%c in (114,1,255)do call:c3 203 0 %%c
for /l %%b in (1,1,255)do call:c2 203 %%b
for /l %%a in (204,1,223)do call:c1 %%a
exit/b
:a1
for /l %%b in (0,1,255)do call:a2 %1 %%b
exit/b
:a2
for /l %%c in (0,1,255)do call:a3 %1 %2 %%c
exit/b
:a3
for /l %%d in (0,1,255)do if not %2%3%%d==000 if not %2%3%%d==255255255 echo %1.%2.%3.%%d
exit/b
:b1
for /l %%b in (0,1,255)do call:b2 %1 %%b
exit/b
:b2
for /l %%c in (0,1,255)do call:b3 %1 %2 %%c
exit/b
:b3
for /l %%d in (0,1,255)do if not %3%%d==00 if not %3%%d==255255 echo %1.%2.%3.%%d
exit/b
:c1
for /l %%b in (0,1,255)do call:c2 %1 %%b
exit/b
:c2
for /l %%c in (0,1,255)do call:c3 %1 %2 %%c
exit/b
:c3
for /l %%d in (1,1,254)do echo %1.%2.%3.%%d

Edit: Saved 46 82 bytes by removing unnecessary spaces. Saved 18 bytes by using exit/b instead of goto:eof.

I count 1872 bytes. You technically don't need the @echo off, as well.

@FlagAsSpam Probably CRs; Notepad likes to save them.

I think you can remove them, since we count by Unix UTF-8 bytes.

source: Stack Exchange

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

sort: votes


text:
Calculate the day number of the year
Seems like we do not have this one yet, so here we go:
The Challenge
Write a program or function that takes a date as input and outputs the day number of the year. You may not use any builtins for that!
Rules

As usual you may write a full program or a function.
The format of the input is up to you, but it has to contain a year, a month and a day. Make clear which one your solution uses!
No date-related builtins allowed! You gotta do the work by yourself. Builtins which are not related to date operations are fine.
Base for the calcultion is the gregorian calendar.
You have to take account of leap-years.
You only need to handle years in the range [1, 9999]
Standard loopholes are forbidden.
Lowest byte count wins!

Testcases
Input format here is YYYY/MM/DD
2016/07/05 -> 187
2000/03/28 -> 88
0666/06/06 -> 157
6789/10/11 -> 284
0004/04/04 -> 95
1337/07/13 -> 194

Happy Coding!

Can we use builtins for days since a certain date? What about for whether a year is a leap year?

@Thomas No date-related builtins allowed. Gonna clarify that in the challenge, thanks for the comment! :)

@DenkerAffe Why did you forbid all built-ins?

Pyth, 31 bytes
+s<X1+L28jC"3»î"4!%|F_jQ*TT4tEE

Thanks to @Dennis and @Jakube for the leap year portion. Input is YYYY, MM, DD on separate lines.
+                          add [day] to
  s <                      sum of first [month]-1 values in the list
      X                    add 1 to
        1                  the second element (January)...
        +L                 \
           28              |
           j               }   lengths of all the months
             C "3»î"       |
             4             /
        ! %                ... if the year is a leap year; that is, 4 divides...
            |F _ j         fold logical OR over reversed
                   Q       the year
                   *TT     converted to base 100
            4
      t E                 [month]-1
  E                       [day]

Test suite.

JavaScript ES6, 81 69 bytes
(y,m,d)=>d+parseInt("03479cehkmpr"[--m],36)+m*28-(y%(y%25?4:16)&&m>1)

Assuming months are 1-based, otherwise I could save 2 bytes.
Edit: Saved 12 bytes using @user81655's tip.

C, 96 102 89 61 bytes
g(y,m,d){printf("%d",m/2*31+--m/2*30-(y%(y%25?4:16)?2:1)+d);}

Python 3, 152 148 150 bytes
m,d,y=map(int,input().split());n=[0,31,(59,60)[(y%4==0 and y%100!=0)or y%400==0]]
for i in range(m):n+=[n[-1]+(31,30)[i in[1,3,6,8]]]
print(n[-4]+d)

Takes dates in the format "M D YYYY".

You should use Python 2, unless you need specific features from Python 3. Because then you don't need brackets in your prints which allows you to save one byte by wrinting your print as print n[m-1]+d

In the first line, you could write y%4==0and y%100!=0, I think

Python 2, 100 82 bytes
A Python port of @Neil's answer:
lambda d,m,y:d+int("03479cehkmpr"[m-1],36)+(m-1)*28-(y%(4if y%25 else 16)and m>2)

As with the previous answer, adding 17 bytes (99 bytes total) will yield a full program:
print(lambda d,m,y:d+int("03479cehkmpr"[m-1],36)+(m-1)*28-(y%(4if y%25 else 16)and m>2))(*input())

Previous answer:
As an anonymous lambda:
lambda d,m,y:d+sum(31-(n in(3,5,8,10))for n in range(m-1))-(3if y%4 or(y%400!=0and y%100==0)else 2)

Can be converted to a named lambda for a 2 byte penalty. Alternatively, a full program (taking input in the format D,M,Y) can be achieved for 117 bytes:
print(lambda d,m,y:d+sum(31-(n in(3,5,8,10))for n in range(m-1))-(3if y%4 or(y%400!=0and y%100==0)else 2))(*input())

A few small golfs gets 76 bytes

Nibbles, 28 bytes
+-=@`\:0.``@1370+30$+?-@2- 2%+.::4 100 400^0%_$~0

Attempt This Online!
Takes the year, month and day as command-line arguments.
Edit: Care to explain why this was downvoted?

Re downvote: probably for the same reason that all the other 8 answers except for the awk one were downvoted.  Only the downvoter knows the reason, and nobody knows for sure who he/she is.  Although it is somewhat intriguing that the author of the awk answer has placed 9 downvotes this week...

@DominicvanEssen Interesting observation. Hmmm…

Python 3, 125 bytes
print((lambda d,m,y:sum([3,not(y%400 and not y%100 or y%4),3,2,3,2,3,3,2,3,2,3][:m-1])+m*28-28+d)(*map(int,input().split())))

An another approach to this problem. The code takes advantages of the Python's boolean algebra execution priorities and since not is the last operation, conversion to boolean is automatic. When summation is done, the boolean is treated as 1 or 0. Input format is "YY MM DDDD" string.
Input system inspired by @SteveEckert's similar one.
Another form as a function, 91 bytes
def f(d,m,y):return sum([3,not(y%400 and not y%100 or y%4),3,2,3,2,3,3,2,3,2,3][:m])+m*28+d

In this case input is three integers, the month being between 0-11. This would work in Python 2 also.

Excel, 106 bytes
=AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100))))+30*B1-31+CHOOSE(B1,1,2,0,1,1,2,2,3,4,4,5,5,6)+C1

Takes input in three cells A1 = Year, B1 = Month, C1 = Day.

AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100))))

1 if LeapYear, else 0
30*B1-31+CHOOSE(B1,1,2,0,1,1,2,2,3,4,4,5,5,6)+C1

Multiple of 30, CHOOSE for additional days, plus days in month

Evolution:
=IF(AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)))),1,0)+CHOOSE(B1,0,31,59,90,120,151,181,212,243,273,304,334,365)+C1
=IF(AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)))),1,0)+CHOOSE(B1-1,31,59,90,120,151,181,212,243,273,304,334,365)+C1
=IF(AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)))),1,0)+30*(B1-1)+CHOOSE(B1,0,1,-1,0,0,1,1,2,3,3,4,4,5)+C1
=IF(AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)))),1,0)+30*B1-30+CHOOSE(B1,0,1,-1,0,0,1,1,2,3,3,4,4,5)+C1
=IF(AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)))),1,0)+30*B1-31+CHOOSE(B1,1,2,0,1,1,2,2,3,4,4,5,5,6)+C1
=AND(C1>2,OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100))))+30*B1-31+CHOOSE(B1,1,2,0,1,1,2,2,3,4,4,5,5,6)+C1

Scala, 126 bytes
Port of @Neil's Javascript answer in Scala.

Golfed version. Try it online!
(y,m,d)=>d+Integer.parseInt("03479cehkmpr".toSeq(m-1).toString,36)+(m-1)*28-(if ((y%(if (y%25==0)16 else 4)!=0)&&m>1)1 else 0)

Ungolfed version. Try it online!
object Main {
  def dayOfYear(y: Int, m: Int, d: Int): Int = {
    val monthOffsets = "03479cehkmpr".toList
    d + Integer.parseInt(monthOffsets(m - 1).toString, 36) + (m - 1) * 28 - (if ((y % (if (y % 25 == 0) 16 else 4) != 0) && m > 1) 1 else 0)
  }

  def main(args: Array[String]): Unit = {
    println(dayOfYear(2016, 07, 05))  // 187
    println(dayOfYear(2000, 03, 28))  // 88
    println(dayOfYear(0666, 06, 06))  // 157
    println(dayOfYear(6789, 10, 11))  // 284
    println(dayOfYear(0004, 04, 04))  // 95
    println(dayOfYear(1337, 07, 13))  // 194
  }
}

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:
Mutually fill in the blanks
Given an input of two strings with sequences of underscores representing
corresponding words, output the sentences with the "blanks" filled in.
The best way to describe this challenge is by example. Here is an example
input:
programming _____________ and code golf
programming puzzles ______ code ____

And here is the corresponding output:
programming ___puzzles___ and code golf
programming puzzles _and__ code golf

For the purposes of this challenge, a "word" is defined as a sequence of one or
more lowercase letters, and a "blank" is defined as one or more underscores
(the input will always contain only lowercase letters, spaces, and
underscores). Words and blanks in the input strings are separated by single
spaces, and the sum of the number of words and blanks in the sentences will
always be equal.
The objective of the challenge is to fill all of the blanks with the correct
words, which are the words that occupy the same index in the other string
when split by spaces.

The word must be centered in the blank, as shown with the word "puzzles" in
the example above—an equal number of underscores remain on either side.
If the word cannot be exactly centered, the extra underscore may go either on
the left or the right (ex. the word "and" in the example above).
There will always be enough underscores for the word to fit, but there may be
exactly as many as the length of the word (ex. the word "golf" in the example
above).
There will never be a blank in the same position in both strings.

Input/output may be any of the following (input/output do not necessarily have
to be via the same method):

single string separated by any character
that is not alphabetic, a space, or an underscore (ex. newline or comma
separated string)
an array/list/etc. of two strings
two function/command line arguments (input only)

Since this is code-golf, the shortest code in bytes will win.
The example above can be used as a test case. Here is a larger test case
(second string in output may vary slightly due to different centering behavior):
lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum
lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum

lorem ipsum dolor _sit_ amet __consectetur__ adipiscing elit mauris dapibus tincidunt ____________metus____________ accumsan fringilla proin vulputate viverra lorem fermentum dictum
lorem ipsum dolor_ sit _amet__ consectetur __adipiscing___ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem _________fermentum__________ dictum

Nice bidiurnal challenge.

Pyth, 30
jL;Cmm|*}J\_k.[lkhx#JdJkdCcR;Q

Takes input and outputs as a list of two strings. Uses a pretty basic split–zip–double map–centre–zip–join approach.
Try it here
Expanded:
jL;Cmm|*}J\_k.[lkhx#JdJkdCcR;Q   ##
                          cR;Q   ##  split
                         C       ##  zip
    mm                           ##  double map
      |*}J\_k.[lkhx#JdJkd        ##  centre
   C                             ##  zip
jL;                              ##  join

I'll explain more once I'm really satisfied that I can't golf this any more, although it should be pretty clear, given the ubiquity of the split–zip–double map–centre–zip–join approach and all.

Ahhh, the classic split-zip-double map-centre-zip-join approach. I fondly remember it being used as an introductory example in my Algorithms 101 lecture.

@MartinBüttner Yeah, I have some bad memories of it because I slept through that class, had to solve problems on the exam using the duplicate-append-lookback-match-add-centre approach instead.

I'll go apply some cold water to the burn.

Retina, 102 100 93 88 bytes
Byte count assumes ISO 8859-1 encoding.
$
!¶$`
m`(?<=^(\w+ )*)(?=_.*¶(?<-1>\w+ )*(\w+))
$2
(([a-z])+)(?<-2>_)*(_*)\3|!\D+
$3$1$3

The strings will are separated by a linefeed. If there is an odd number of underscores left, the extraneous one will be after the word.
Try it online!
Explanation
I guess this is the "duplicate-append-lookback-match-add-centre approach", or something close...
$
!¶$`

We start by duplicating the input (separated with a ! and a linefeed). The purpose of this is that we can then process both lines by fetching words from the next line (instead of having to treat the second line separately).
m`(?<=^(\w+ )*)(?=_.*¶(?<-1>\w+ )*(\w+))
$2

This prepends the correct word to each gap. We start by counting the current word position with the lookbehind (?<=^(\w+ )*) (the position is stored as the depth of group 1). Then the lookahead a) ensures that we're at the beginning of a gap by matching _, then skips to the next line with .*¶, matches the correct number of words with (?<-1>\w+ )* to get to the right position, and then matches the word found there with (\w+) into group 2.
(([a-z])+)(?<-2>_)*(_*)\3|!\D+
$3$1$3

This stage does three things:

It removes the underscores corresponding to each word length. This is done by counting the word length into group 2 with ([a-z])+ and then matching that many underscores (which are never written back).
It shifts the word to the centre of the gap by capturing half of the remaining underscores with (_*)\3 and writing $3$1$3 back.
It removes the duplicated input by matching !\D+ and replacing it with nothing.

Python 2, 109
def f(a,b):exec"print' '.join([x,y][x<'`'].center(len(x),'_')for x,y in zip(a.split(),b.split()));a,b=b,a;"*2

The function takes two strings as arguments and prints the output as in the examples. It uses a boring approach, with str.center(width, fillchar) doing most of the work.
Try it online.

I don't think you need z, unless I'm missing something you can just do the swap after the print and inline z.

@FryAmTheEggman yeah, you're right. Thanks :)

Ruby, 111 109 characters
->l{l.map(&:split).transpose.map{|c|c[m=c[0]<c[1]?0:1]=c[1-m].center c[m].size,?_
c}.transpose.map{|s|s*' '}}

Input: array of 2 strings; output: array of 2 strings.
Sample run:
2.1.5 :001 > puts ->l{l.map(&:split).transpose.map{|c|c[m=c[0]<c[1]?0:1]=c[1-m].center c[m].size,?_;c}.transpose.map{|s|s*' '}}[[
2.1.5 :002 >       'programming _____________ and code golf',
2.1.5 :003 >       'programming puzzles ______ code ____',
2.1.5 :004 >       ]]
programming ___puzzles___ and code golf
programming puzzles _and__ code golf

JavaScript, 194 185 bytes
f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,(k='_'.repeat(s/2))+b+k+(s%2?'_':'')),H=(e,y)=>e.map((x,i)=>G(x,i,y)).join` `,[H(m,1),H(n)])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            (k='_'.repeat(s/2))+b+k+(s%2?'_':'')
        ),
    H=(e,y)=>e.map((x,i)=>G(x,i,y)).join` `,
    [H(m,1),H(n)]
)

document.body.innerHTML = '
' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')
" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "

" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')
" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'
'

Mathematica 223
There must be a shorter way to do this.
k=StringLength;m=StringSplit;
g=Partition[Riffle[m@#,m@#2],2]/.{{a_,a_}:> a<>" ",{a_,b_/; StringTake[b,1]=="_"}:> a<>" ",
{a_,b_}:>Table["_",Ceiling[z=(k@a-k@b)/2]]<>b<>""<>Table["_",Floor@z]<>" "}&;
s_~h~t_:={""<>g[s,t],""<>g[t,s]}

Sample run
h["programming _____________ and code golf", "programming puzzles ______ code ____"]

Gema, 208 203 characters
\B=@set{i;0}
=@push{${v;f};$0}@incr{i}
\n=@set{v;s}@set{i;0}
 =
\E=@repeat{$i;@cmps{$f;$s;@set{f;@fill-center{$f;$s}};;@set{s;@fill-center{$s;$f}}}@set{F;$f ${F;}}@set{S;$s ${S;}}@pop{f}@pop{s}}$F\n$S

Just because Gema has the perfect function for this task: @fill-center{background;value}.
Input: 2 newline separated lines (no final newline); output: 2 newline separated lines (with trailing spaces – not seem to be forbidden).
Sample run:
bash-4.3$ echo -ne 'programming _____________ and code golf\nprogramming puzzles ______ code ____' |
> gema '\B=@set{i;0};=@push{${v;f};$0}@incr{i};\n=@set{v;s}@set{i;0}; =;\E=@repeat{$i;@cmps{$f;$s;@set{f;@fill-center{$f;$s}};;@set{s;@fill-center{$s;$f}}}@set{F;$f ${F;}}@set{S;$s ${S;}}@pop{f}@pop{s}}$F\n$S'
programming ___puzzles___ and code golf
programming puzzles _and__ code golf

C, 197 bytes
#define c(w,y)l=strspn(w,"_"),r=strcspn(y," "),memcpy(w+(l-r)/2,y,r),w+=l,y+=r;
main(l,v,w,y,r)char**v,*w,*y;{for(w=v[1],y=v[2];*w;w++,y++)if(*w^*y)if(*w^95)c(y,w)else c(w,y)puts(v[1]);puts(v[2]);}

Output
$ ./a.out "lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum" "lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum"
lorem ipsum dolor _sit_ amet __consectetur__ adipiscing elit mauris dapibus tincidunt ____________metus____________ accumsan fringilla proin vulputate viverra lorem fermentum dictum
lorem ipsum dolor_ sit _amet__ consectetur __adipiscing___ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem _________fermentum__________ dictum

ES6, 122 bytes
a=>a.map(s=>s.split` `).map((s,n,a)=>s.map((w,i)=>w<'a'?(l=w.length,t=w+a[n^1][i]+w,t.substr(t.length-l>>1,l)):w).join` `)

Takes an array of two strings as a single parameter and returns another array of two strings.


text:
Code words in integer sequences
Introduction
Pareidolia: From Ancient Greek; παρα (para, “concurrent, alongside”) + εἴδωλον (eídōlon, “image”). The tendency to interpret a vague stimulus as something known to the observer, such as interpreting marks on Mars as canals, seeing shapes in clouds, or hearing hidden messages in music. Source: Wiktionary.
For example:

Paralogia: From Ancient Greek; παρα (para, “concurrent, alongside”) + λόγος (lógos, “speech, oration, word, ...”). The tendency to perceive words in arbitrary sequences of characters, such as in code golf programs. Source: yeah, I made that up (actually the word means something else, as pointed out by @Martin).
For example:
    df4$/H)hEy_^p2\
    jtK2$)look|x1$

Challenge
Write a program that takes a positive integer as input, produces an integer as output, and includes an English word as part of the code. The input-output relationship must correspond to an integer sequence that can be found in OEIS.
Rules

Only words from this list are allowed. This is admittedly arbitrary, but it's essential that we all agree on which words are accepted; and in that regard this list is probably as good as any other.
Words need to be formed by concatenating at least two function names or statements. If your language for example has a function called correlation it can't be used as is. The concatenation has to be strict: no other symbols should appear between the parts of the word. For example, bro~ken would not count as a word.
Case is unimportant: both valid and vaLiDare acceptable.
Words within strings do not count. The letters that make up the word need to be functions or statements in the language of choice, that is, something that is actually executed. For example, the following code would not be allowed: 'deoxyribonucleic'~1, where '...' is a string, ~ discards the previous content, and 1 just prints number 1.
Every letter of the word should be necessary. This means that removing a single letter from the word should change the input-output relation. That includes outputting a different sequence, or outputting any other thing(s), or producing no output, or causing an error.
Any positive integer should be acceptable as an input, and should produce an output, except for data-type or memory restrictions.
The outputs corresponding to inputs 1, 2, 3, ... should correspond to a sequence appearing in OEIS. No other output should be produced; only an integer number, possibly with trailing or leading whitespace.
Input and output can be function arguments or stdin/stdout.

Score
The score is computed as total code length minus twice the length of the longest word, in characters. Or equivalently, number of not-in-longest-word characters minus length of longest word.
Lowest score wins.
Examples
Consider an imaginary postfix language that has these functions: c: input a number; At: compute square; $: add 1.
cAt would be a valid program (its output corresponds to the sequence 1, 4, 9, ..., which is A000290), and it would have score −3.
cAt$ would also be valid (sequence 2, 5, 10, ..., which is A002522), with score −2.
c$At would not be valid, because the only word here is "At" and is produced by a single function or statement.

I think this should be a popularity contest.

@MCMastery This would not make a good popularity contest. (Most challenges wouldn't.)

This is essentially limited to golfing languages though.

CJam, -20
COUNTErREVOLUTIONARIES],

Outputs the nth element in the sequence A010861.
COUNTE                      e# push values of six preinitialized variables
      r                     e# read a token of input
       REVOLUTIONARIES      e# push values of 15 other preinitialized variables
                      ]     e# wrap whole stack in array
                       ,    e# get length

Removing a character from the word results in a completely different sequence A010860. There is a quite interesting relationship between the two sequences: at every index n, A010860(n) is coprime to A010861(n)! There must be some deep mathematical reason behind this.
Try it here.

I have discovered another curious mathematical relationship: if you subtract the A010860 sequence from the A010861 sequence, the result always equals 1 at every index! Fascinating...

This one's going to be hard to beat :-)

Oh, upper case..  Great idea :)

CJam, -5
limpet;

A010051: prints 0 for composite numbers and 1 for primes.
It took me forever to find something that scored a few points and would break at the removal of any letter. Removing anything except m throws an error, and removing m turns the program into the identity function.
li  e# Read input and convert to integer.
mp  e# Check for primality.
et  e# Get current datetime as a list.
;   e# Discard the datetime again.

Try it online.

Beautiful choice of sequence! :-)

05AB1E, -4 -11
Code, prints A010869 (constant 30):
ASYNcHRonouSlyI)g

Previous code:
DoGS

Explanation:
D     # Duplicate top of the stack
 o    # Pop a, push 2**a
  G   # For N in range(1, 2**a):
   S  # Push all chars seperate from the top of the stack

Prints the A010879 sequence.

That's the most interesting sequence so far!

Crossed out -4 is still regular -4 ;(

MATL, −6
INhale

Try it online!
Produces sequence 1, 2, 3, ... (A000027)
Removing any letter changes the output, or leaves the program expecting a second input which doesn't exist, or produces an error.
Explanation
The program simply inhales a number and, after some fiddling around, exhales it unchanged.
I    % produces number 3
N    % number of elements in stack: produces number 1
h    % concatenates horizontally into array [3, 1]
a    % true if any element is nonzero. So it gives true (or equivalently 1)
l    % produces number 1
e    % triggers implicit input and reshapes into a 1x1 array. So it leaves input unchanged

Pyth, 1
*QhSatan0000
   Satan

Explanation?
       n00   - 0 != 0 (0)
      a   0  - abs(^-0) (0, Required so it doesn't print out a random 0)
     t       - ^-1 (-1, required or will output 0 all the time)
    a      0 - abs(^-0) (1, Required so counts in right direction, would also print out a random 0)
   S         - 1-indexed range ([1], required so next command works properly)
  h          - Get the head (if `S` missed, will out 2)
*Q           - Multiply by Q

1, 2, 3, 4, 5...
Sequence A000027
Subliminal messages? Never.
Try it here.

Japt, -6
NuLLIFIED)r^

Outputs A004453: nimsum of N and 12  (N XOR 12). Test it online!
Note: the OEIS sequence is 0-indexed, so an input of 0 will result in the first item.
How it works
        // Implicit: N = array of inputs
Nu      // Push the following things to N:
LLIF    // 100, 100, 64, 15,
IED     // 64 again, 14, and 13.
)r^     // Reduce by XORing (using ^ between each pair)
        // The reduction goes as follows: U, U^100, U, U^64, U^79, U^15, U^1, U^12.

Nice! Any explanation, when you can?

@LuisMendo Sure, done. It's incredibly simple, but I haven't found anything more complex yet.

@LuisMendo Updated. This one's a little more interesting.

Indeed! But apparently removing the Y produces the same output? (unless I'm doing something wrong)

@Luis Is this better?

Yes indeed it is!

Headsecks, score −4
exit

This maps to the Brainfuck program ,+-., which reads a single character and prints it, calculating A000030. Removing any character will obviously break it.
There's also marshal (,-<>+-.), which is effectively ,-., but that doesn't correspond to any OEIS sequence.

x86 machine code, score -4
Hexdump of the code:
53 51 55 41 53 68 69 65 73 74 51 58 83 c4 14 c3

Or, in code page 437:
SQUAShiestQXâ─¶├

Assembly code:
push ebx
push ecx
push ebp
inc ecx
push ebx
push 0x74736569
push ecx
pop eax
add esp, 0x14
ret

A function that adds 1 to its argument.
Removing A turns it into an identity function. Removing any other byte messes up the stack, causing either a crash or bad behavior of the calling function.
I am pretty sure it's possible to improve the score, but it may depend on the interpretation of the requirements. For example, using the word SQUEAMIShness gives a program, that increases and then decreases the ebp register. Does removing any of these cause a crash? A simplest test program doesn't use the ebp register, so maybe it doesn't... To avoid this doubt, I used a shorter word.

Ruby, score 3
puts gets.partition''

This computes the identity sequence A000027. Output is surrounded by some whitespace; I hope that's okay.

Yes, whitespace is fine

Math++, score -2
?*sine

Implements A000004.


text:
Hypercube elements
Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube.
As an example, the 3 dimensional cube has 1 cell (i.e. 1 3-dimensional cube), 6 faces (i.e. 6 2-dimensional cubes), 12 edges (i.e. 12 2-dimensional cubes) and 8 vertices (i.e. 8 0-dimensional cubes).
More details about Hypercube elements can be found here
You can as well take a look at the following OEIS sequence.
Input
Your code will take as input (via STDIN or a function parameter or similar things) an integer greater or equal to 0, which is the dimension of the hypercube.
Your code has to theoretically work for any input >= 0, disregarding memory and time issues (that is, speed and potential stack overflows are not a problem for your answer if the input is big). Inputs given as test cases will not be above 12.
Output
You will ouput a list of all elements of the hypercube, starting with the "highest dimension" element. For example, for a cube (input = 3), you will output the list [1,6,12,8] (1 cell, 6 faces, 12 edges, 8 vertices).
The format of the list in the output is relatively free, as long as it looks like a list.
You can output the result to STDOUT or return it from a function.
Test cases
Input = 0
Output = [1]

Input = 1
Output = [1,2]

Input = 3
Output = [1,6,12,8]

Input = 10
Output = [1, 20, 180, 960, 3360, 8064, 13440, 15360, 11520, 5120, 1024]

Input = 12
Output = [1, 24, 264, 1760, 7920, 25344, 59136, 101376, 126720, 112640, 67584, 24576, 4096]

Scoring
This is code-golf, so the shortest answer in bytes wins.

Samau, 8 5 bytes
Saved 3 bytes thanks to Dennis.
▌2\$ⁿ

Hex dump (Samau uses CP737 encoding):
dd 32 2f 24 fc

Explanation:
▌        read a number
 2\      push the array [1 2]
   $     swap
    ⁿ    take the convolution power

Convolving two vectors is equivalent to multiplying two polynomials. Similarly, taking the n-th convolution power is equivalent to taking the n-th power of a polynomial.

J, 13 bytes
[:p.2&^;$&_.5

Inspired by @alephalpha's PARI/GP answer. Try it online with J.js.
Background
By the binomial theorem,

Thus, the output for input n consist precisely of the coefficients of the above polynomial.
Code
[:p.2&^;$&_.5  Monadic verb. Argument: n

        $&_.5  Yield an array of n instances of -0.5.
    2&^        Compute 2^n.
       ;       Link the results to the left and right.
               This specifies a polynomial of n roots (all -0.5)
               with leading term 2^n.
[:p.           Convert from roots to coefficients.

MATL, 8 bytes
1i:"2:X+

Inspired by @alephalpha's PARI/GP answer.
Try it online! (uses Y+ for modern day MATL)
How it works
1        % Push 1.
 i:      % Push [1 ... input].
   "     % Begin for-each loop:
    2:   %   Push [1 2].
      X+ %   Take the convolution product of the bottom-most stack item and [1 2].

My first MATL answer.

And an excellent one! It's such an honour that you used this language :-)

Beautiful. Everyone's starting to jump on the MATL bandwagon now!

@rayryeng We miss you :-)

MATL, 12 bytes
Q:q"H@^G@Xn*

Try it online
Explanation
         % implicit: input number "n"
Q:q      % generate array[0,1,...,n]
"        % for each element "m" from that array
  H@^    % compute 2^m
  G      % push n
  @      % push m
  Xn     % compute n choose m
  *      % multiply
         % implicit: close loop and display stack contents

Mathematica, 29 bytes
CoefficientList[(1+2x)^#,x]&

My first Mathematica answer! This is a pure function that uses the same approach as Alephalpha's PARI/GP answer. We construct the polynomial (1+2x)^n and get the list of coefficients, listed in order of ascending power (i.e. constant first).
Example usage:
> F := CoefficientList[(1+2x)^#,x]&`
> F[10]
{1,20,180,960,3360,8064,13440,15360,11520,5120,1024}

PARI/GP, 20 15 bytes
n->Vec((x+2)^n)

APL, 15 11 bytes
1,(2*⍳)×⍳!⊢

This is a monadic function train that accepts an integer on the right and returns an integer array.
Explanation, calling the input n:
        ⍳!⊢  ⍝ Get n choose m for each m from 1 to n
       ×     ⍝ Multiply elementwise by
  (2*⍳)      ⍝ 2^m for m from 1 to n
1,           ⍝ Tack 1 onto the front to cover the m=0 case

Try it online
Saved 4 bytes thanks to Dennis!

Jelly, 8 bytes
0rð2*×c@

I should really stop writing Jelly on my phone.
0r            Helper link. Input is n, inclusive range from 0 to n. Call the result r.
  ð           Start a new, dyadic link. Input is r, n.
   2*         Vectorized 2 to the power of r
     ×c@      Vectorized multiply by n nCr r. @ switches argument order.

Try it here.

TI-BASIC, 10 bytes
3^Ansbinompdf(Ans,2/3

I think this is one of the more interesting solutions.  I don't know if I would have ever thought of binompdf.

CJam (17 14 bytes)
ri_3@#_2+@#\b`

Online demo
This approach uses the ordinary generating function (x + 2)^n. The OEIS mentions (2x + 1)^n, but this question indexes the coefficients in the opposite order. I'm kicking myself for not thinking to reverse the g.f. until I saw Alephalpha's update to the PARI/GP answer which did the same.
The interesting trick in this answer is to use integer powers for the polynomial power operation by operating in a base higher than any possible coefficient. In general, given a polynomial p(x) whose coefficients are all non-negative integers less than b, p(b) is a base-b representation of the coefficients (because the individual monomials don't "overlap"). Clearly (x + 2)^n will have coefficients which are positive integers and which sum to 3^n, so each of them will individually be less than 3^n.
ri     e# Read an integer n from stdin
_3@#   e# Push 3^n to the stack
_2+    e# Duplicate and add 2, giving a base-3^n representation of x+2
@#     e# Raise to the power of n
\b`    e# Convert into a vector of base-3^n digits and format for output

Alternative approaches: at 17 bytes
1a{0X$2f*+.+}ri*`

Online demo
or
1a{0X$+_]:.+}ri*`

Online demo
both work by summing the previous row with an offset-and-doubled row (in a similar style to the standard manual construction of Pascal's triangle).
A "direct" approach using Cartesian powers (as opposed to integer powers) for the polynomial power operation, comes in at 24 bytes:
2,rim*{1b_0a*2@#+}%z1fb`

where the map is, unusually, complicated enough that it's shorter to use % than f:
2,rim*1fb_0af*2@f#.+z1fb`

ES6, 71 bytes
n=>[...Array(n+1)].fill(n).map(b=(n,i)=>!i?1:i>n?0:b(--n,i-1)*2+b(n,i))

Simple recursive formula. Each hypercube is created by moving the previous hypercube 1 unit through the Nth dimension. This means that the M-dimensional objects are duplicated at the start and end of the unit, but also the (M-1)-dimensional objects gain an extra dimension, turning into M-dimensional objects. In other words, c(n, m) = c(n - 1, m) * 2 + c(n - 1, m - 1). (The actual submission reverses the parameters so that the formula outputs in the desired order.)
Ingeniously, fill allows map to provide the correct arguments to the recursive function, saving me 6 bytes.

05AB1E, 9 bytes
Code:
WƒNoZNc*,

Explanation:
W          # Push input and store in Z
 ƒ         # For N in range(0, input + 1)
  No       # Compute 2**N
    ZNc    # Compute Z nCr N
       *   # Multiply
        ,  # Pop and print

Uses CP-1252 encoding.

Pyth, 10 9 bytes
.<L.cQdhQ

Uses the nCr algorithm everyone seems to be using.

L-map saves a byte: .<L.cQdhQ

Octave, 31 bytes
Use the formula from A013609: T(n,k) = 2^k*binomial(n,k).
Try it online!
f=@(n)bincoeff(n,0:n).*2.^(0:n)

Julia, 31 bytes
n->[2^m*binomial(n,m)for m=0:n]

This is a lambda function that accepts an integer and returns an integer array. To call it, assign it to a variable.
For each m from 0 to the input n, we count the number of (n-m)-dimensional hypercubes on the boundary of the parent n-dimensional hypercube. Using the formula on Wikipedia, it's simply 2m * choose(n, m). The case of m = 0 refers to the n-cube itself, so the output begins with 1 regardless of the input. Edges are given by m = n, vertices by m = n - 1, etc.

J, 11 bytes
(,+2*,~)&0#

Attempt This Online!
(,+2*,~)&0#
          #    constant 1
(      )&0     inner function bound to 0 on the right, repeated n times to 1...
 ,               append 0
   2*,~          prepend 0, and then double each number
  +              elementwise add the two

J, 12 bytes
1|.@p.@;$&_2

A minor variation of Dennis's J solution. Attempt This Online!
(!~*2^])i.,]

A minor variation of Alex A's APL solution. Attempt This Online!
1|.@p.@;$&_2
1      ;$&_2    create an array (1; -2 -2 ... -2)
    p.          construct a polynomial having that many -2s as roots
 |.             reverse it

(!~*2^])i.,]
        i.,]    create an array 0, 1, 2, ..., n
    2^]         2^0, 2^1, ..., 2^n
 !~             nC0, nC1, ..., nCn
   *            elementwise multiply

Ruby, Rev B 57 bytes
->n{a=[1]+[0]*n
(n*n).downto(n){|i|a[1+j=i%n]+=2*a[j]}
a}

The previous rev only scanned through the used part of the array each time. This rev scans through the entire array on every iteration. This is slower, but it saves bytes. A further byte is saved by using 1 loop to do the job of 2.
Ruby, Rev A 61 bytes
->n{a=[1]+[0]*n
n.times{|i|i.downto(0){|j|a[j+1]+=2*a[j]}}
a}

Starts with a point and iteratively creates the next dimension
In each iteration, each existing element increases in dimensionality and generates 2 new elements of its original dimensionality. For example, for a square in the horizontal plane that is extended vertically to become a cube:
The 1 face becomes a cube and generates 1 pair of faces (1 above, 1 below)
The 4 edges become faces and generate 4 pairs of edges (4 above, 4 below)
The 4 vertices become edges and generate 4 pairs of vertices (4 above, 4 below)
Ungolfed in test program
f=->n{a=[1]+[0]*n                  #make an array with the inital point and space for other dimensions
  n.times{|i|                      #iteratively expand dimension by dimension
    i.downto(0){|j|a[j+1]+=2*a[j]} #iterating downwards (to avoid interferences) add the 2 new elements generated by each existing element.
  }
a}                                 #return the array

p f[gets.to_i]

JavaScript (Node.js), 44 bytes
f=n=>n?[...f(n-1),i=0].map(v=>i*2+(i=v)):[1]

Try it online!
# JavaScript (Node.js), 51 bytes
f=n=>n?[0,...f(n-1)].map((v,i,e)=>~~e[++i]+v*2):[1]

Try it online!
binomial(n,m)*2^m


text:
"I know that language - that's Java. No? It's Perl?"
Introduction
A known fact is that Jon Skeet can code Perl and make it look like Java. In this challenge you will try to do something similar.
Challenge
Write a piece of code of any length that can be executed without any errors/exceptions in two different languages. Your program can take inputs, give outputs, whatever it wants.
The code has to be executed with interpreters/compilers of your choice one after another (with basic settings, means you are not allowed to adjust the compiler/interpreter settings).
Note that the source code and any used sources (files, libs and so on) are not allowed to change during the execution of the script with the compilers/interpreters.
But which languages are "different"?
Two languages are different from each other if they are not the same language without looking at the version. Example: Python 3.5 is not different to Python 2.7.
Scoring
The final score consists out of several aspects:

charScore: Take your code and then (max charScore is 95)...

Look at every function and delete all arguments (in echo "Hello" "Hello" counts as an argument). So now only keywords and functions count. Example: System.out.println(1+1); becomes System.out.println();
Make all strings to empty strings and all regex and literals empty. Example: "khffshiufahk" becomes "" and all regex (without string) gets deleted.
Delete all comments. Example: //Jon Skeet would also do this becomes [nothing]
_Definition of "comment": _ Anything that doesn't change the execution of the program (So you could simply leave them out and nothing would change).
Delete all characters that are not unicode 32-126. Example: print(2²) becomes print(2)
Count only the occurrences of the letters. Example: hiiiiiii-thhheeeree has the same score as hi-there (means score of 8)

Here is a StackSnippet to do step 3 and 4 for you (report me if there is a bug):

function calcScore() {
 var onlyValidChars = "";
 var code = document.getElementById("code").value;
 for (i = 0; i < code.length; i++) {
  if (code[i].charCodeAt(0)>=32 && code[i].charCodeAt(0)<=126) { //step 3
     if (onlyValidChars.indexOf(code[i]) === -1) { //step 4
       onlyValidChars += code[i];
         }
       }
 }
  return onlyValidChars.length;
}
function showCalcScore() {
 alert("Your charScore: "+calcScore());
}
<body>
    <textarea placeholder="Insert your code here." id="code"></textarea>
    <br>
    <button type="button" onclick="showCalcScore();">calculate score</button>
  </body>

+20 if your code is still executable in both languages now (after the charScore-changes)
+50 if running the code with the different interpreters does different things (eg order change, prints other things etc)
+15 if your languages are Perl and Java

The answer with the highest score wins.
EDIT: I don't think that this is a duplicate (but very releated) because it has no "different language" limits and no score. On the other hand, I didn't know about so-called "polyglot"-code so maybe  I am wrong.

This is my first question on this site. If anything is unclear feel free to ask or edit. (I'm not sure if everything is clear in this challenge.)

What tags should I use for this question?

@Mego It it very releated but not the same I think.

The [tag:polyglot] tag applies, and I would also recommend looking over existing polyglot challenges if you haven't already done so.

The scoring is different.

You should make rule #1 under charScore include regex literals (and perhaps other kinds of literals). Otherwise a single regex literal that includes every single character is a valid Ruby+Perl submission.

@Doorknob You are probably right. That doesn't seem to work well.

How could I put that into regex?

Also, what is your definition of "comments"?

Also, Pyth and Python 3 are very different.  One is specifically designed for golfing, and the other isn't.  Pyth was originally derived from python, but now is its own language.

@Doorknob Edited the question.

@RikerW Yeah, that was just an example. I know that the filtering is not the best. First, I wanted to have something like this but that would have made everything very complicated.

@Doorknob The question - charScore - 1 now includes regex and literals. But there is another problem: You could probably also make a request to http://abc.de/fegh... :(

@palsch just limit it to different versions of the same language.  That generally works fine.

PHP + Lenguage, 165
Scoring calculation: 95 + 20 + 50.
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

In PHP, this outputs the string verbatim (since there is no <? to signal for the preprocessor functionality).
In Lenguage, this is an infinite loop.
The charScore changes do not affect the program, as it consists of all 95 printable ASCII characters once, so it is eligible for the +20 bonus.

Pig does not seem to fulfill the requirements of a valid programming language.

@PhiNotPi This has been rectified (s/Pig/Lenguage/).

I guess it's a lucky coincidence that lenguage program #95 is an infinite loop.

@PhiNotPi Not really. Anything that doesn't output that string would have worked anyway.


text:
Write a program to output the nth fibonacci number in quinary
Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program.
The Fibonacci Sequence is the well known sequence
F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2)
Write a program that takes some input n and outputs the nth fibonacci number in quinary.
Standard code golf rules apply.

Can we read program code using filesystem IO?

@HannesKarppila That's considered a standard loophole for quines.

Yes it is, but actually question does not use word quine, so I asked. Of course it usually is, but I wanted to be sure if that applies here.

@Mego I believe you are supposed to output F(n) in binary, but with the reversed program for 0 and the program code for 1. So if your code was 1234, and the input was 4, you'd output 12341234 (11), and for 5, you'd output 123443211234 (101).

@es1024 Ah, thank you for clearing that up, I didn't read so well.

@Hannes, it's tagged [tag:quine]

Is the program allowed to be a palindrome? (Same backwards and forwards)

@Loovjo yes, it is, but I don't think that makes it any easier

CJam, 30 bytes
{s"_~"+UXri{_@+}*;2bWfe|\f%}_~

Try it online!
How it works
{                          }_~  Define a code block, and push and execute a copy.
 s                              Convert the original code block to a string.
  "_~"+                         Append "_~" to the string.
       UXri                     Push 0, 1 and an integer N from STDIN.
           {   }*               Do N times:
            _                     Push a copy of the topmost integer.
             @                    Rotate the bottom-most integer on top of it.
              +                   Push the sum of the copy and the rotated integer.
                 ;              Discard the topmost stack item, i.e., F(N+1).
                  2b            Convert the remaining stack item to base 2.
                    Wfe|        Logical OR all binary digits with -1.
                                This turns 0's into -1's.
                        \f%     For each binary digits A, take each Ath item of the
                                generated string.
                                This pushes the string itself for A = 1, and the
                                reversed string for A = -1.

Python, 226 bytes
s='s=%r;a,b=0,1;exec"a,b=b,a+b;"*input();print"".join(map(lambda i:(s%%s)*int(i)+(s%%s)[::-1]*(1-int(i)),bin(a)[2:]))';a,b=0,1;exec"a,b=b,a+b;"*input();print"".join(map(lambda i:(s%s)*int(i)+(s%s)[::-1]*(1-int(i)),bin(a)[2:]))

It's quite a heavy modification to the standard Python Quine. It uses a,b=0,1;exec"a,b=b,a+b;" to generate Fibonacci numbers.

I get syntax error on both python 2 and 3.

@k_g Weird, the program works for me in 2.7.3. Are you sure you copied the whole thing?

Oh, whoops, it works. I was using python3 in both my tests. Who knew python -> python3?

, 24 chars / 44 bytes
⟮Мȫïⓑⓢⓜ+$?(a=ɕṡ+ᶈ0):aᴙ)⨝

Try it here (Firefox only).
Explanation
Standard quine framework: ⟮ɕṡ+ᶈ0
⟮Мȫïⓑⓢⓜ+$?(a=ɕṡ+ᶈ0):aᴙ)⨝ // implicit: ï=input
⟮                           // copy block start
 Мȫï                       // get nth Fibonacci number
    ⓑⓢⓜ                  // convert to binary, split along chars, map
         +$?               // is mapitem truthy?
            (a=ɕṡ+ᶈ0)      // if so, replace w/ quine as is
                     :aᴙ)  // else replace w/ reverse quine
                         ⨝ // join
                           // implicit output

What's ɕṡ+ᶈ0? Is that a quine builtin?

Naw, ɕṡ refers to character ⟮ and ᶈ0 is a string representation of the contents of the copy block.

ℹ is the quine function, which isn't used/allowed here.

That's a good way to quine without a quine builtin.

Found it by accident.

Could you add a link to this language?

https://github.com/molarmanful/ESMin

Javascript ES6, 121 bytes
$=_=>[...(a=`$=${$};$()`,f=x=>x>1?f(x-1)+f(x-2):x)(prompt()).toString(2)].map(x=>+x?a:[...a].reverse().join``).join``;$()

I'm looking for ways to shorten the Fibonacci function...

Python 3.8 (pre-release), 113 bytes
exec(s:="f=lambda x:x<2or f(x-1)+f(x-2)\nfor i in f'{f(int(input())):b}':print(('exec(s:=%r)'%s)[::2*int(i)-1])")

Try it online!


text:
Compute the winding number
The winding number is the integer number of net counterclockwise revolutions an observer must have made to follow a given closed path. Note that any clockwise revolutions count negative towards the winding number. The path is allowed to self intersect.
Some examples (shamelessly taken from Wikipedia) are given below:

Your goal is to compute the winding number for a given path.
Input
The observer is assumed be at the origin (0,0).
The input is a finite sequence of points (pair-like of integer numbers) from any desired input source which describes the piece-wise linear path. You may flatten this into a 1D sequence of integer numbers if desired, and may also swizzle the input to take all x coordinates before all y coordinates/vise-versa. You may also take the input as a complex number a+b i. The path may self intersect and may contain zero-length segments. The first point is the start of the path and is assumed to lie somewhere on the positive x axis.
No part of the path will intersect the origin. The path will always be closed (i.e. the first and lost point are the same). Your code may either imply the last point or require it to be included.
For example, depending on your preference both inputs specify the same square:
implied end point
1,0
1,1
-1,1
-1,-1
1,-1

explicit end point
1,0
1,1
-1,1
-1,-1
1,-1
1,0

Output
The output is a single integer for the winding number. This may be to any source (return value, stdout, file, etc.).
Examples
All examples have the end point explicitly defined and are given as x,y pairs. Incidentally, you should be able to also directly feed these examples into any codes assuming implicitly defined end points and the outputs should be the same.
1. Basic test
1,0
1,1
-1,1
-1,-1
1,-1
1,0

Output
1

2. Repeated point test
1,0
1,0
1,1
1,1
-1,1
-1,1
-1,-1
-1,-1
1,-1
1,-1
1,0

Output
1

3. Clockwise test
1,0
1,-1
-1,-1
-1,1
1,1
1,0

Output
-1

4. Outside test
1,0
1,1
2,1
1,0

Output
0

5. Mixed winding
1,0
1,1
-1,1
-1,-1
1,-1
1,0
1,-1
-1,-1
-1,1
1,1
1,0
1,1
-1,1
-1,-1
1,-1
1,0
1,1
-1,1
-1,-1
1,-1
1,0

Output
2

Scoring
This is code golf; shortest code wins. Standard loopholes apply. You may use any builtin functions so long as they were not specifically designed to compute the winding number.

Can input be taken as complex numbers (or a string representation of them, such as "1-i" or "1-1i" ?)

yes, any type of pair is allowed.

ES6, 83 bytes
a=>a.map(([x,y])=>r+=Math.atan2(y*b-x*c,y*c+x*b,b=x,c=y),b=c=r=0)&&r/Math.PI/2

Takes as input an array of pairs of points which are interpreted as complex numbers. Rather than converting each point into an angle, the points are divided by the previous point, which Math.atan2 then converts into an angle between -π and π, thus automatically determining which way the path is winding. The sum of the angles is then 2π times the winding number.
Since Math.atan2 doesn't care about the scale of its arguments I don't actually perform the full division z / w = (z * w*) / (w * w*) instead I just multiply each point by the complex conjugate of the previous point.
Edit: Saved 4 bytes thanks to @edc65.

Nice and fast. And I don't understand your math. But reduce is almost always a bad choice.

a=>a.map(([x,y])=>r+=Math.atan2(y*b-x*c,y*c+x*b,b=x,c=y),b=c=r=0)&&r/Math.PI/2 using map instead or reduce. You have my vote anyway

@edc65 Thanks; I used reduce because I didn't realise that Math.atan2(0,0) is 0. (Well, it depends on whether one of your 0s is actually -0.) The maths is based on complex division, which is normally calculated as z / w = z * w* / |w|², but I don't care about the magnitude, so it's just multiplication by the complex conjugate. Also slightly confusingly Math.atan2 accepts (y, x) arguments.

I admit I don't understand the code, but if your description is accurate, then I believe your answer is wrong. Indeed, if you inputted points from this path (I'm giving a picture for greater clarity) then the winding number is 1, while your problem would output 2.

@Wojowu Sorry, I meant the angle between the points as measured from the origin, rather than the polygon's external angles, so for your picture, my code should indeed compute the answer as 1.

MATL, 11 bytes
X/Z/0)2/YP/

Input is a sequence of complex numbers including the end point.
Try it online!
Explanation
Most of the work is done by the Z/ function (unwrap), which unwraps angles in radians by changing absolute jumps greater than or equal to pi to their 2*pi complement.
X/       % compute angle of each complex number
Z/       % unwrap angles
0)       % pick last value. Total change of angle will be a multiple of 2*pi because
         % the path is closed. Total change of angle coincides with last unwrapped
         % angle because the first angle is always 0
2/       % divide by 2
YP/      % divide by pi

MATL and Jelly have pretty much tied most mathy challenges lately. I'm impressed, you've almost out-meta-golfed Dennis' language...

@ETHproductions Thanks for your nice words! Yes, they have been tied in some recent challenges. On the other hand, I've seen quite a few problems where Jelly's byte count is about half as MATL :-D

Jelly, 11 bytes
æAI÷ØPæ%1SH

This takes input as a list of y-coordinates and a list of x-coordinates.
Try it here.

Python, 111
Longest answer so far.  My motivations are 1) learn python and 2) possibly port this to pyth.
from cmath import *
q=input()
print reduce(lambda x,y:x+y,map(lambda (x,y):phase(x/y)/pi/2,zip(q[1:]+q[:1],q)))

Input is given as a list of complex numbers.
Ideone.
I think the approach is similar to the ES6 answer.
When 2 complex numbers are multiplied, the argument or phase of the product is the sum of the argument or phase of the two numbers.  Thus when a complex number is divided by another, then the phase of the quotient is the difference between the phases of the numerator and denominator.  Thus we can calculate the angle traversed through for each point and the next point.  Sum these angles and divide by 2π gives the required winding number.

Python 3 version: sum(map(lambda c:phase(c[1]/c[0]),zip(q,q[1:]+q[:1])))/pi/2


text:
Tune the oscilloscope display
The Scenario
I am building a fancy oscilloscope but I need your help. The oscilloscope can display any number of individual waveforms at the same time (e.g. sine waves) but I don't know how to synchronise the display so it doesn't jump around too much.
The Challenge
Your program or function will take a series of floating point numbers as its input. The first number will be the width of the oscilloscope screen (there will be different models with larger or smaller screens). The remaining numbers will be the wavelength (not the frequency) of each waveform and will always be less than the width of the display. The amplitude of the waveforms is unimportant, so is not given. The only thing you need to know about the amplitude is that it will never be zero.
Your code must output the distance from the start where all the waveforms are as in-sync as possible for the width of the display. This is assumed to be when there is the smallest horizontal distance possible when each waveform is at 0 degrees (therefore, also with a height of zero). If there are multiple best matches, use the largest one (furthest from the left edge of the display).
An example is displayed below. The vertical lines are where each of the waves are most in-sync with the others. The inputs are 100 [3.14159265358979, 2.71828182845905, 1.41421356237310] (the image has been scaled up by a factor of 10) and the outputs, in order, are [40.8407044966673, 40.7742274268858, 41.0121933088199]. Your code must display at least 5 significant digits unless the decimal representation ends before that. The numbers must be output in the same order as the inputs.

You need to find the greatest multiple of each input number where the maximum distance between them all is as small possible, without going over the upper bound of the screen width. If there is even a single irrational ratio the smallest maximum distance will never be 0 for finite numbers. [0 ...] will never be an answer as all of the waveforms will fit at least once on the display before repeating. The maths to calculate the numbers is a lot easier than it appears initially. You can separate the output numbers with any delimiter - it doesn't have to be a space or a comma; use brackets if there is an easier option in your language, as long as the digits are correct to as many places as shown. The same goes for the input; if it's easier to tab separate the numbers, for example, that's OK, as is any other delimiter as long as the numbers are input exactly as shown in the test data.
Test data:
In: 10 [3.16227766016838]
Out: [9.48683298050514]

In: 100 [3.16227766016838]
Out: [98.0306074652198]

In: 105 [6, 7]
Out: [84, 84]

In: 1050 [6, 7]
Out: [1050, 1050]

In: 90 [5, 6, 7]
Out: [85, 84, 84]

In: 100 [5, 6, 7]
Out: [90, 90, 91]

In: 200 [5, 6, 7]
Out: [175, 174, 175]

In: 300 [5, 6, 7]
Out: [210, 210, 210]

In: 100 [1.4142135623731, 3.14159265358979, 2.71828182845905]
Out: [41.0121933088199, 40.8407044966673, 40.7742274268858]

In: 100 [3.14159265358979, 2.71828182845905, 1.4142135623731]
Out: [40.8407044966673, 40.7742274268858, 41.0121933088199]

In: 300 [3.14159265358979, 2.71828182845905, 1.4142135623731]
Out: [141.371669411541, 141.350655079871, 141.42135623731]

In: 900 [3.14159265358979, 2.71828182845905, 1.4142135623731]
Out: [383.274303737954, 383.277737812726, 383.25187540311]

In: 1000 [3.14159265358979, 2.71828182845905, 1.4142135623731]
Out: [907.920276887449, 907.906130705323, 907.92510704353]

In: 100 [1.73205080756888, 2, 2.23606797749979, 2.44948974278318, 2.64575131106459]
Out: [24.2487113059643, 24, 24.5967477524977, 24.4948974278318, 23.8117617995813]

In: 1000 [1.73205080756888, 2, 2.23606797749979, 2.44948974278318, 2.64575131106459]
Out: [129.903810567666, 130, 129.691942694988, 129.822956367509, 129.641814242165]

As an example, lets take the following test case:
In: 200 [5, 6, 7]
Out: [175, 174, 175]

At [5, 6, 7] ([1*5, 1*6, 1*7]) you can show that each number is as close as possible to its neighbours without changing any of the multiples. The minimum distance to contain all the numbers is 2 (7-5). But is there a smaller solution less than 200? At [35, 36, 35] ([7*5, 6*6, 5*7]) the minimum distance to contain all the numbers is now only 1 (36-35). Can we get it smaller? The next smallest distance is at [210, 210, 210] ([42*5, 35*6, 30*7]) which is optimal at 0 (210-210), however, 210 is larger than 200 so is not allowed in this case. The largest solution below or equal to 200 is [175, 174, 175] ([35*5, 29*6, 25*7]), also with a distance of 1 (175-174).
This is code-golf, so shortest solution wins!

Judging by the test cases it looks like all the waveforms are at 0 degrees at position 0, but 0 isn't allowed as an answer? Unless I'm mistaken and missed something, could you please clarify these two points in the post?

You are talking about the "point" where the horizontal distance is minimal. But where exactly is this point, as there actually is whole range to be considered? BTW: You could remove a ton of unnecessary information from this challenge. In the end we only have to consider arithmetic series, you can omit the whole part about sine waves and the oscilloscope. That way, the challenge itself would be a lot clearer.

@flawr It took me a while to grasp this. Take the test case 105 6 7 which looks a lot clearer like this: 105 [6,7]. The waveforms coincide exactly at 42 and 84, and then again at 126, but you have to take the largest which will fit in the screen width, which is therefore 84. For some of the other cases a perfect match is not available. I think the oscilloscope analogy does help a little because it is a practical application of what is required, but I think a bit of explanation of the test cases could make it much clearer.

I think this question is asking for the greatest multiple of the LCM which is less than a given bound, but it's not clear what the output should be if the LCM exceeds that bound.

@PeterTaylor It is clear: if it doesn't match, you should choose the point which is the closest to all of them. (Ok, so it's not clear, but it is there!)

What does "closest to all of them" mean? What is the actual function to minimise?

What does "the greatest multiple of each input number where the maximum distance between them all is as small possible" mean? If the input is 10 [1 1.001] should the output be 1 1.001 on the basis the larger multiples would increase the width of the range?

@PeterTaylor Yes, that is the case. Eventually, all pairs of numbers will get closer than that, but you might run out of room on the display first.

Python (3.5) 240 bytes
A non optimal solution.
It works on all test but that's a really really slow solution since we test each possibility.
Solution
import numpy as n
def f(w,s):
 l = len(s)
 def g(t,m,k,z):
  if t!=[]:
   u,*v=t
   for i in n.arange(u,w+1,u):
    m,k=g(v,m,k,[*z,i])
  else:
   j=sum(abs(sum(z[1:])/l-i) for i in z[1:])
   if j<=m+1e-9 :
    return j,z
  return m,k
 print(g(s,w,0,[0])[1][1:])

Explanation
Importation of numpy module
import numpy as n

Function definition w:screen length s:"wavelength"
def f(w,s):
 l = len(s)

Définition of the recursive function
with t wavelength, m minimum, k value of the minimum point, z current point
 def g(t,m,k,z):

the recursive test : if t is non empty we go "deeper" in the recursion
  if t!=[]:
   u,*v=t

loop on each zeros of the sinus function
   for i in n.arange(u,w+1,u):

call the recursive function
    m,k=g(v,m,k,[*z,i])
  else:

the "function" to minimize
   j=max(z[1:])-min(z[1:])

test for the minimum (1e-9 because there is a precision issu)
   if j<=m+1e-9 :
    return j,z
  return m,k
 print(g(s,w,0,[0])[1][1:])

Results:
>>> f(300, [5, 6, 7])
[210, 210, 210]
>>> f(100, [5, 6, 7])
[90, 90, 91]

Previous iteration
In first try i use the distance between points and barycenter
   j=sum(abs(sum(z[1:])/l-i) for i in z[1:])


text:
The RATS sequence
Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: http://oeis.org/A004000.
test cases:
0 > 1
1 > 2
2 > 4
3 > 8
4 > 16
5 > 77
6 > 145
7 > 668

For example, the output for 5 is 77 because 16 + 61 = 77. After this the 77 is sorted.
Shortest submission wins. This is my first challenge so i hope this is not a duplicate or something.

Does the input have to be an Integer or could it also be a string?

@DenkerAffe do you mean a number in the form of a string?

@justaprogrammer Yea, so I can get "123" instead of 123 as Integer. Would mayve save some bytes.

@DenkerAffe sure, if that works best

isn't 77+77=154? Or have I missed something? EDIT: Oh, yes, I forgot to sort.

@DenhamCoote I think you meant "oh rats, I forgot to sort!"

MATL, 11 12 bytes
1i"tVPU+VSU

Input is a string (with single quotes) representing an integer in unary. String input is allowed by the challenge, and unary is a valid format.
Try it online!
Explanation
1      % push number 1 to the stack
i      % input. Will be a string of "n" ones
"      % for loop: repeat n times (consumes string)
  t    %   duplicate
  V    %   convert to string
  P    %   reverse
  U    %   convert to number
  +    %   add
  V    %   convert to string
  S    %   sort
  U    %   convert to number
       % loop is implicitly ended
       % stack content is implicitly displayed

I don't know which scares/perplexes me more, MATL or Jelly... +1

05AB1E, 6 bytes
Code:
$FDR+{

Explanation:
$       # Push 1 and input
 F      # For N in range(0, input)
  D     # Duplicate top of the stack
   R    # Reverse top of the stack
    +   # Add top two items
     {  # Sort top of the stack
        # Implicitly print top of the stack

This also works with a 0 byte program.

@Adnan Three days ago, actually. Still, well played...

@Doorknob Just in time haha

You can save 6 bytes by eliminating your source code.

You can also shorten 05AB1E by first eliminating the leading zero, and then omitting the 1, as 1E==E. Then you get just 5ABE, -2 bytes.

@Dennis great observation

Does this language do the problem by default or something?

@djechlin yes. This language can, without any code, solve this exact problem.. >.> (line 2059: https://github.com/Adriandmen/05AB1E/commit/1c339310d567fce64b307344cf08d396ac71b4ae)

is @justaprogrammer actually Adnan in disguise?

I think he saw that in the sandbox and added the thing

@Dennis this reminds me of Stuck printing “Hello, world!” without any input. That is an amazing observation.

5 bytes lol

I challenge you with this question: https://codegolf.stackexchange.com/questions/240385/invent-new-programming-language-and-write-hello-world-in-it :)

Pyth, 17 13 12 bytes
uS`+vGv_GQ\1

u        Q\1    reduce range(input()) on base case of "1" (string)
   +vG          eval the string (to get a number), and add...
      v_G       the same number, reversed first and then eval'd
 S`             convert back to string and sort

Try it on the online interpreter.

What is this magic? How does this work?

@justaprogrammer I've added an explanation. :)

Huh, but how. How do you test this code?

@justaprogrammer I've added a link to an online interpreter that you can run the code on.

This is awesome, it is so short, yet so beautiful

CJam, 15 bytes
1ri{_sW%i+s$i}*

Test it here.
Explanation
1     e# Push 1 as the start of the sequence.
ri    e# Read input and convert to integer N.
{     e# Run this block N times...
  _s  e#   Duplicate and convert to string.
  W%  e#   Reverse string.
  i+  e#   Convert back to integer and add to previous value.
  s$  e#   Convert to string and sort.
  i   e#   Convert back to integer for the next iteration.
}*

how can all these languages be so short

@justaprogrammer Single-character names for built-in functions help. ;) CJam, Pyth and Brachylog are all golfing languages, specifically designed with code golf in mind. (See https://en.wikipedia.org/wiki/Code_golf#Dedicated_golfing_languages.) Then there's also languages like APL and J that aren't golfing languages at all but are similarly terse, because the designers thought it would be a good idea.

Which one do you recommend the most for winning challenges like these?

@justaprogrammer I wouldn't pick one based on which one is winning these challenges (that would likely be Pyth or Jelly). It can be just as fun to golf in a "normal" language (especially because there might be more competition within that language). For a golfing language, it's probably more important that you enjoy using it. CJam is quite fun - it's a stack-based which makes you bend your mind a bit more than other languages, and at the same time it's quite a powerful language, that I've started to use for simple throwaway scripts outside of golf, which is a good boost to my productivity.

These languages look very interesting and I can't wait to learn one myself. I don't know what jelly is? Is that some kind of gelatine or something?

@justaprogrammer Jelly is Dennis's language: https://github.com/DennisMitchell/Jelly ... I think documentation is still pretty sparse for it though (and the language is under active development).

JavaScript ES6, 70 bytes
Saved 1 byte thanks to @user81655
f=n=>n?+[...+[...''+(b=f(n-1))].reverse().join``+b+''].sort().join``:1

sigh JavaScript is really verbose. A lot (> 50%) of the code is just case to string + array function + join + cast to int. I've tried reduce, eval, and all sorts of stuff but this seems to be the shortest.
Try it online (All browsers work)

Just like mine, but better (and posted earlier). Bah!

String Manipulation is JS is so long, you have my condolences

@user81655 cool, thanks! I would of never thought to re-order that way

f=n=>n?[...+[...b=f(n-1)].reverse().join``+b+''].sort().join``:'1' if returning string allowed

Python 2, 72
f=lambda x,n=1:x and f(x-1,int(''.join(sorted(`n+int(`n`[::-1])`))))or n

Recursive function, makes use of the Python 2 shorthand for __repr__, which will break once the function reaches very large values (an L will be appended to the number's string), I'm not certain from the spec if there is a place where we can stop, but if not changing to str() only adds 6 bytes, but then it becomes slightly shorter to output as a string, at 75 bytes:
f=lambda x,n='1':x and f(x-1,''.join(sorted(str(int(n)+int(n[::-1])))))or n

1 byte saved thanks to trichoplax on this version

Is that a surplus space before the or in the second code block?

@trichoplax thanks for the catch :)

Brachylog, 19 bytes
0,1 .|-1=:0&Rr+R=o.

Explanation
0,1 .               § If Input is 0, unify the Output with 1
     |              § Else
      -1=:0&R       § unify R with the output of this main predicate, with input = Input - 1
             r+R=o. § Reverse R, add it to itself and order it, then unify with the Output.

Haskell, 67 bytes
import Data.List
g i=i:g(sort$show$read i+read(reverse i))
(g"1"!!)

Usage example: (g"1"!!) 7-> "668".
It's a direct implementation of the definition: starting with "1", repeatedly append the reverse-add-sort result of the current element. The main function (g"1"!!) picks the ith element.

This is the most readable program under 70 bytes!

Julia, 77 bytes
n->(x=1;for _=1:n x=(p=parse)(join(sort(["$(x+p(reverse("$x")))"...])))end;x)

This is a lambda function that accepts an integer and returns an integer. To call it, assign it to a variable.
Ungolfed:
function f(n::Int)
    # Begin x at 1
    x = 1

    # Repeat this process n times
    for _ = 1:n
        # Add x to itself with reversed digits
        s = x + parse(reverse("$x"))

        # Refine x as this number with the digits sorted
        x = parse(join(sort(["$s"...])))
    end

    # Return x after the process (will be 1 if n was 0)
    return x
end

Jelly, 13 12 bytes
I'm sure this can probably be golfed, as this is my first answer in Jelly/in a tacit language.
DUḌ+ðDṢḌ Performs RATS
1Ç¡      Loops

D        Converts integer to decimal
 U       Reverses
  Ḍ      Converts back to integer
   +     Adds original and reversed
    ð    Starts new chain
     D   Converts back to decimal
      Ṣ  Sorts
       Ḍ Back to integer again

1        Uses 1 instead of input
 Ḍ       Uses line above
  ¡      For loop

EDIT: Saved 1 byte, thanks to Dennis

Perl 6, 40 bytes
{(1,{[~] ($_+.flip).comb.sort}...*)[$_]} # 40

( If you want it to return an Int put a + right before [~] )
Usage:
# give it a lexical name
my &RATS = {…}

say RATS 5; # 77

# This implementation also accepts a list of indexes

# the first 10 of the sequence
say RATS ^10; # (1 2 4 8 16 77 145 668 1345 6677)

Lua, 179 156 Bytes
I can't see how I could golf it more, but I'm sure there's a way. Thanks to @LeakyNun I took the time to come down on this and golf it the proper way, I could maybe still win some bytes by using another approach.
k=0z=table
for i=0,io.read()do
t={}(""..k+(""..k):reverse()):gsub("%d",function(d)t[#t+1]=d
end)z.sort(t)k=k<1 and 1or tonumber(z.concat(t,""))
end
print(k)

Ungolfed and explanations
k=0
z=table                              -- z is a pointer on the table named table
                                     -- it allows me to use its functions
                                     -- while saving 4 bytes/use

for i=0,io.read()                    -- Iterate n times for the nth element
do
  t={}
  (""..a+(""..a):reverse())          -- we add k with its "reversed" value
                                     -- and convert the whole thing to a string
    :gsub(".",function(d)            -- for each character in it, use an anonymous fucntion
       t[#t+1]=d end)                -- which insert them in the array t
  z.sort(t)
  a=a<1 and 1 or                     -- if i==0, k=1
     tonumber(z.concat(t,""))        -- else we concat t in a string and convert it to number
end
print(k)

Well it looks like you aren't here anymore... but maybe you can refer to my java answer.

@LeakyNun Well, I'm not participating a lot this times but still peaking at challenges from time to times, I'll try to take a look at your answer, but even without that I see some thing that can be golfed pretty easily (a=a<1 and 1or for instance).

we would be glad  – I would be glad  – to have you back.

Java 1.8, 251 bytes
interface R{static void main(String[]a){int i,r,n=1,c=0,t=Byte.valueOf(a[0]);while(++c<=t){i=n;for(r=0;i!=0;i/=10){r=r*10+i%10;}n+=r;a[0]=n+"";char[]f=a[0].toCharArray();java.util.Arrays.sort(f);n=Integer.valueOf(new String(f));}System.out.print(n);}}

Expanded
interface R{
static void main(String[]args){
    int input,reversed,nextValue=1,count=0,target=Byte.valueOf(args[0]);
    while(++count<=target){
        input=nextValue;
        for(reversed=0;input!=0;input/=10){reversed=reversed*10+input%10;}
        nextValue+=reversed;
        args[0]=nextValue+"";
        char[]sortMe=args[0].toCharArray();
        java.util.Arrays.sort(sortMe);
        nextValue=Integer.valueOf(new String(sortMe));
    }
    System.out.print(nextValue);
}
}

Why do you use interface R instead of class R which is 4 bytes shorter?

@WillSherwood because you can then omit the public modifier on main(), making it shorter overall :)

Seriously, 17 bytes
1,`;$R≈+$S≈`n

Try it online!
Explanation:
1,`;$R≈+$S≈`n
1              push 1
 ,`       `n   do the following n times:
   ;$R≈        reverse
       +       add
        $S≈    sort

Python 2, 70 66 bytes
f=lambda n,a=1:n<1or int(''.join(sorted(`f(n-1)+f(n-1,-1)`))[::a])

Try it online!

Brachylog 2, 11 bytes, language postdates challenge
;1{↔;?+o}ⁱ⁽

Try it online!
Explanation
;1{↔;?+o}ⁱ⁽
  {     }ⁱ  Repeatedly apply the following,
 1            starting at 1,
;         ⁽   a number of times equal to the input:
   ↔            reverse,
    ;?+         add the original input,
       o        then sort the resulting number

I'm not quite clear on what this does with zero digits, but the question doesn't state any particular handling, and they probably don't appear in the sequence anyway.

Husk, 10 bytes
!¡ödOdS+↔1

Try it online!
1-indexed.

ES6, 79 bytes
n=>eval("r=1;while(n--)r=+[...+[...r+''].reverse().join``+r+''].sort().join``")

82 bytes without eval:
n=>[...Array(n)].reduce(r=>+[...+[...r+''].reverse().join``+r+''].sort().join``,1)

All those conversions are painful.
@edc65 I actually saved 4 bytes by switching from map to reduce this time... no doubt you'll prove me wrong again though.

for is shorter: n=>eval("for(r=1;n--)r=+[...+[...r+''].reverse().join\`+r+''].sort().join``")`

@Doᴡɴɢᴏᴀᴛ Doesn't work for n=0, even after I've fixed the syntax errors.

Python 2, 91 Bytes
Input as Integer, result is printed to the screen.
def f(n):
 t=1
 for i in range(n):t=int("".join(sorted(str(int(str(t)[::-1])+t))))
 print t

This could be a lot shorter with some recursion magic I guess, but I cant wrap my head around it yet. Gonna have a fresh look later and hopefully improve this one.

Python 2, 83 bytes
def f(n):
 v='1'
 for _ in v*n:v=''.join(sorted(str(int(v)+int(v[::-1]))))
 print v

Mathematica 10.3, 66 61 bytes
Nest[FromDigits@Sort@IntegerDigits[#+IntegerReverse@#]&,1,#]&

Quite simple.

Java, 171 167 163 160 bytes
int f(int n){int a=n>0?f(n-1):0,x=10,b[]=new int[x],c=a,d=0;for(;c>0;c/=x)d=d*x+c%x;for(a+=d;a>0;a/=x)b[a%x]++;for(;a<x;c=b[a++]-->0?c*x+--a:c);return n>0?c:1;}

Try it online!
Not the longest entry! \o/

@Katenkyo see this

It is ok f(1)...f(20) But from f(21) result seems wrong...

Loss of precision I suppose.

PHP, 102 Bytes
$r=[1];$i++<$argn;sort($v),$r[]=join($v))$v=str_split(bcadd(strrev($e=end($r)),$e));echo$r[$argn];

Online Version
PHP, 95 Bytes
n <= 39
for($r=[1];$i++<$argn;sort($v),$r[]=join($v))$v=str_split(strrev($e=end($r))+$e);echo$r[$argn];

K (oK), 20 bytes
{x{.o@<o:$x+.|$x}/1}

Try it online!

Scala, 56 bytes
Stream.iterate("1"){p=>p.toInt+p.reverse.toInt+""sorted}

Try it online!
An infinite stream.

cQuents, 9 bytes
=1:sZ+\rZ

Try it online!
1-indexed.
Explanation
=1            first term is 1
  :           sequence mode
              each term equals
   s                           sort(                                   )
    Z                                previous
     +                                        plus
      \r                                           reverse(          )
        Z                                                   previous

PowerShell Core, 91 89 87 76 bytes
$ofs=''
for($c="1";$args[0]--){$c="$("$(+$c+"$($c[20..0])")"|% t*y|sort)"}$c

Try it online!
PowerShell converts strings to long by default. The maximum length would always be 19 chars.
Cool challenge!
-2 bytes thanks to Mazzy!

for is shorter in the Powershell. Try it online!

Vyxal, 7 5 bytes
1?(ms

Try it Online!
Explained
1?(ms

1?          # Push 1 followed by the input
  (         # for n in range(0, input):
    m       #   push tos + tos[::-1] (palindromize on integers doesn't make it a palindrome)
     +s     #   add and sort the result

It's a shame how in order to remain competitive, one has to port other answers. Why do I say this? Because I have a nifty 21 byte function that accomplishes the same task:
@f:1|0=[1|n⨪@f;:ŉ+]s;

Example usage:
6 @f; , # Single number
0 11 r °f; z # Provide a test case unit kinda display

what does ŉ do?

@Razetime it reverses the top of the stack

would m work instead of :ŉ ?

@Razetime no, because it pushes a + reversed(a) not a, reversed(a)

I meant 1?(ms, it says TODO is not defined

@Razetime a + a[::-1] != [a, a[::-1]]

Let us continue this discussion in chat.

Perl 5 -a, 51 bytes
$.=join'',sort(($.+reverse$.)=~/./g)while$_--;say$.

Try it online!

50 bytes

Axiom, 146 bytes
c(r:String):NNI==reduce(+,[(ord(r.i)-48)*10^(#r-i) for i in 1..#r]);f(n:INT):NNI==(n<1=>1;v:=f(n-1);v:=v+c(reverse(v::String));c(sort(v::String)))

test and results [RATS sequence]
(3) -> [[i, f(i)] for i in 0..20]
   (3)
   [[0,1], [1,2], [2,4], [3,8], [4,16], [5,77], [6,145], [7,668], [8,1345],
    [9,6677], [10,13444], [11,55778], [12,133345], [13,666677], [14,1333444],
    [15,5567777], [16,12333445], [17,66666677], [18,133333444], [19,556667777],
    [20,1233334444]]

Tcl, 91 bytes
proc R n {join [lsort [split [expr {$n?[set v [R [expr $n-1]]]+[string rev $v]:1}] ""]] ""}

Try it online!

Japt, 9 bytes
1-indexed.
_+ìw)ìñ}g

Try it
_+ìw)ìñ}g     :Implicit input of integer U
_             :Function taking an integer Z as input
 +            :  Add
  ì           :    Convert Z to digit array
   w          :   Reverse and convert back
    )         :  End add
     ì        :  Convert result to digit array
      ñ       :  Sort and convert back
       }      :End function
        g     :Starting with 1, do that U times

Arn, 13 8 bytes
Ignore that it was previously 13 bytes, I never realized sorting doesn't cast back to strings when needed, so I fixed that.
'▀ƒʠBÀ½Ó

Try it!
Explained
Unpacked: &.{:>+.<}1
&.            Mutate X N times via block B
  {           B has key of `_`
    :>        Sort ascending
        _     Implied
      +       Plus
          _   Implied
        .<    Reversed
  }           End block
1             and X is the number one
_             and N is STDIN; implied