text:
Get the most dominant color!
In this challenge, your task is to write a program that takes in an image and returns the most dominant color in it. Dominant color here means the color with which most of the image is covered (see the test cases for a better understanding).

Input
An image's path. You'll have to load that image in your program. You can take the input as STDIN, function argument or whatever suits your language. You may assume that the image will have only .png extension.

Output
The most dominant color in any format. (But it should be accurate, you can't return Red for #f88379). The type of output depends on you. If there is an equal distribution of colors in the image or there are more than one dominant color, then your program should return "Equal". You can show the output by printing on screen, logging on command line or console, or whatever suits you.

Test Cases

=> Red/#ff0000/rgba(255,0,0)
.
=> "Equal"

=> White (or the same color in any other format)
In these test cases, I have posted images rather than image paths, but you'll be given image paths only as input.

Note If your language contains a built-in for this, then you must NOT use it. Please add a screenshot or a link to a screenshot to prove that your program works.

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

because this is kinda unclear. 3 close votes already.

You should have real images. 2. You need a clear definition of "dominant", you can just have it be inferred from test cases.

try clicking the little icon that kinda looks like a painting/background? Or link the image and I will do it.

@EᴀsᴛᴇʀʟʏIʀᴋEdited.

Related.

Any image file format?

@edc65 Only .png.

Could we have the image file contents as input, rather than the path, so that languages without file I/O can compete?

@Mego Yes, you can!

If the language can only load an image from a path asynchronously, can we write a function that returns the value like function dominant(url,function callback(color){...}) where callback() is an input function?

@PatrickRoberts Yes, you can!

Pyth, 18 bytes
FGITW.
?tJeM.MhZrS'Q8\=hJ

This is how it would theoretically work offline.
This is a proof that it works.
The two links differ by whether there is a "read file command" ' (single-quote).

JavaScript (ES6), 301 328 312 bytes
(u,b)=>{i=new Image;i.src=u;e=document.createElement`canvas`;c=e.getContext`2d`;i.onload=_=>{w=e.width=i.width;h=e.height=i.height;c.drawImage(i,0,0);d=c.getImageData(0,0,w,h).data;for(o={},i=0;i<d.length;)++o[s=d.slice(i,i+=4)]?0:o[s]=1;b(o[(a=Object.keys(o).sort((a,b)=>o[b]-o[a]))[0]]==o[a[1]]?"Equal":a[0])}}

Feel free to golf further, this feels as long as Java to me personally.
This supports transparent images so alpha channel is included in output value.
The reason it's longer than before is because now that I've tested, it requires Image to contain the attribute crossOrigin, and the arguments to getImageData() are not optional.
See Meta PCG for removal of CORS from byte count.
Usage
f("http://i.imgur.com/H5OmRVh.jpg", alert)

That will asynchronously alert a color quadruplet or "Equal" after the image is loaded and counted.
The callback is not considered part of the program length because it is allowed as input by the OP in this special case.
How it works
It constructs an Image, a Canvas, and a CanvasRenderingContext2D, then draws the image to the canvas after setting its width and height correctly. It then counts occurrences of each color by implicitly converting each quadruplet to a string and generating a hash of counters. After that, it sorts the hash keys by descending count before comparing the highest two occurrences and determining whether to return the first quadruplet string in the sorted array or the string "Equal".
If the demo below displays a SecurityError, the domain of the image URL you chose does not support CORS.
Demo

f = (u, b) => {
  let i = new Image;
  i.crossOrigin = ''; // CORS added for demo
  i.src = u;
  let e = document.createElement `canvas`;
  let c = e.getContext `2d`;
  i.onload = _ => {
    w = e.width = i.width;
    h = e.height = i.height;
    c.drawImage(i, 0, 0);
    d = c.getImageData(0, 0, w, h).data;
    for (o = {}, i = 0; i < d.length;)
      ++o[s = d.slice(i, i += 4)] ? 0 : o[s] = 1;
    b(o[(a = Object.keys(o).sort((a, b) => o[b] - o[a]))[0]] == o[a[1]] ? "Equal" : a[0])
  }
}
l = i => {
  let p = i.nextElementSibling;
  p.src = i.value;
  f(`http://crossorigin.me/${i.value}`, c => p.nextElementSibling.value = c);
}
document.getElementById `i`.addEventListener('update', e => {
  l(e.target)
})
Array.prototype.slice.call(document.querySelectorAll`.i`, 0, 3).forEach(l)
input {
  display: block;
  box-sizing: border-box;
  width: 205px;
  height: 18px;
}

input.o {
  position: relative;
  top: -36px;
}

img {
  display: block;
  position: relative;
  box-sizing: border-box;
  top: -18px;
  left: 209px;
  height: 40px;
}
<input class=i disabled value="https://i.stack.imgur.com/rqsAX.png">

<input class=o disabled>
<input class=i disabled value="https://i.stack.imgur.com/KECpJ.png">

<input class=o disabled>
<input class=i disabled value="https://i.stack.imgur.com/DRCWd.png">

<input class=o disabled>
<input class=i id=i placeholder="Try any image!">

<input class=o id=o disabled>

Nice answer +1 :)

See http://meta.stackexchange.com/a/267808/313880 for proxying CORS for image tests.

Just to clarify, my demo no longer works because the crossorigin.me CORS service appears to be offline.

MATL, 30 26 23 bytes
Save some bytes by using mode with explicit output specification 6#XM.
2#YiwX:6#XMgY)tn3>?x'='

Previously (26 byte solution)
2#YiwX:S&Y'tX>=Y)tn3>?x'='

Doesn't work online, because of imread. imread can take a path or directly read a url.
Explanation:
2#Yi       % read image, returns a matrix of colours, and a matrix
           % that indexes each pixel to the corresponding row of the colour matrix
w          % swap elements in stack
X:         % linearize index matrix to column array
6#XMg      % use mode to find most common colour indices, convert to matrix (g)
Y)         % get corresponding rows of colour matrix
tn3>       % duplicate and see if it has more than 3 elements
?          % if there is more than one most common colour
x          % delete most common colours from stack
'='        % push string onto stack
           % implicitly finish loop and display stack contents

Output is, for the first image, 1 0 0 (RGB triple), for the second =, and for the third, 1 1 1. For example, a screenshot form Matlab:

Note that you need to escape string delimiters when running MATL code from the Matlab command window, hence the ''=''. The > indicates MATL is asking for user input, in this I gave it the URL of the first test case, and the result is 1 0 0.

Should be able to be golfed more, but I can't quite get it...

You can add a screenshot or a link to a screenshot to prove that it works. Thanks for answering! :)

Python 3, 186 Bytes
from PIL import Image;from collections import*;c=Counter(Image.open(input()).convert("RGB").getdata());d=c.most_common();print("equal") if d[0][1]==d[1][1] else print(c.most_common()[0])

Image 1 prints: ((255, 0, 0), 139876)
Image 2 prints: equal
Image 3 prints: ((255, 255, 255), 101809)

Ungolfed:
from PIL import Image
from collections import *
c = Counter(Image.open(input()).convert("RGB").getdata())
d = c.most_common()
print("equal") if d[0][1] == d[1][1] else print(c.most_common()[0])

Proof:

@Sting sorry that's what I meant, Image 2 is equal and image 3 prints (255,255,255)

@Sting I don't really understand what you mean by a screenshot to prove it works? You want just a screenshot of console output?

Unix tools + imagemagick, 122 bytes
convert png:- ppm:-|tail -n +4|xxd -c3 -p|sort|uniq -c|sort -n|tail -n2|awk '{S[NR]=$1}END{print S[1]==S[2]?"equal":S[2]}'

Expects the input png in stdin, prints the most dominant color in hex (RRGGBB) format.
How it works:

convert png:- ppm:- converts a png file to binary P6 ppm format
tail -n +4 skips the ppm header
xxd -c3 -p puts every RGB byte triplets on a new line in hex format
sort|uniq -c|sort -n orders the colors by their number of occurrence
tail -n2 gets the two most dominant colors
awk ...: prints the more dominant color or equal

PowerShell v2+, 215 bytes
$a=New-Object System.Drawing.Bitmap $args[0]
$b=@{}
0..($a.Height-1)|%{$h=$_;0..($a.Width-1)|%{$b[$a.GetPixel($_,$h).Name]++}}
if(($c=$b.GetEnumerator()|Sort value)[-1].value-eq$c[-2].value){"Equal";exit}$c[-1].Name

(Newlines/semicolons are equivalent, so newlines left in for clarity)
Creates a new Bitmap object, based on the input argument, stores it to $a. Creates a new empty hashtable $b, which will be used for our pixel counting.
We then loop over the image a row at a time with two loops %{...}. Each inner loop we use the .GetPixel method to return a Color object for the particular x/y coordinate we're at. We take the .Name of that color (which is a hexadecimal of the form ARGB, for example ffff0000 would be pure red fully opaque) and use that as the index into $b, incrementing that particular value by one.
So, we've now got a fully populated hashtable of pixel colors, with the values of each entry corresponding to how many pixels of that color there are. We then take $b and pump it through a Sort based on those values, and store that sorted result back into $c. If the last [-1] and second-to-last [-2] values are equal, we output "Equal" and exit. Else, we output the .Name of the last [-1] entry.

Clojure, 204 bytes
(fn[n](let[p(javax.imageio.ImageIO/read(java.net.URL. n))w(.getWidth p)[[_ x][y z]](take-last 2(sort-by peek(frequencies(. p(getRGB 0 0 w(.getHeight p)nil 0 w)))))](if(= x z)(print"EQUAL")(printf"%x"y))))

prints colors as aarrggbb
Clojure isn't really great at golfing, but it's a fun language :)
proof screenshot: https://i.stack.imgur.com/vPgoq.png
ungolfed:
(fn[n]
  (let [p (javax.imageio.ImageIO/read (java.net.URL. n))
        w (.getWidth p)
        a (. p (getRGB 0 0 w (.getHeight p) nil 0 w))
        [[_ x] [y z]] (take-last 2 (sort-by peek (frequencies a)))]
    (if (= x z)
      (print "EQUAL")
      (printf "%x" y)))))

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


text:
Print the nth prime that contains n
This question will be a twist on finding the nth prime number.
Challenge
You must write a program that will take one input n, and output the nth prime number whose decimal representation contains the decimal representation of n as a subtring.
Confused? Here are some examples.
n=1
Primes: 2, 3, 5, 7, 11
                    ^1 first prime that contains a 1
Output: 11

n=2
Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23
        ^1                          ^2 second prime that contains a 2
Output: 23

n=3
Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23
           ^1           ^2          ^3 third prime that contains a 3
Output: 23

n=10
Primes: 2, 3, 5, 7, 11, ..., 97, 101, 103, 107, 109, ..., 997, 1009, 1013, 1019, 1021, 1031, 1033
                                 ^1   ^2   ^3   ^4             ^5    ^6    ^7    ^8    ^9    ^10 tenth prime that contains a 10
Output: 1033

This is code-golf, so lowest byte count wins.
If something is confusing, please leave a comment.

Is there an OEIS for this? It feels like there should be

@SpeedyNinja Nope, I've already checked.

Related

I can't believe that this made it to number 5 on the Hot Network Questions list.

A similar sequence

05AB1E, 8 bytes
Code:
µN¹åNp*½

Explanation:
µ          # Run this until the counting variable has reached the input value.
 N¹å       # Check if the input number is in the range variable.
    Np     # Check if the range variable is prime.
      *    # Multiply those two numbers (which is basically an AND operator).
       ½   # If true, increment the counting variable.
           # After the loop, the stack is empty and implicitly prints N.

Uses CP-1252 encoding. Try it online!.

Pyth - 11 bytes
e.f&P_Z}`Q`

Test Suite.

Python 2, 67 65 62 bytes
f=lambda n,k=0,m=2,p=1:k/n or-~f(n,k+p%m*(`n`in`m`),m+1,p*m*m)

Test it on Ideone.
How it works
We use a corollary of Wilson's theorem:

At all times, the variable p is equal to the square of the factorial of m - 1.
If k < n, k/n will yield 0 and f is called recursively. m is incremented, p is updated, and k is incremented if and only if m is a prime that contains n.
The latter is achieved by adding the result of p%m*(`n`in`m`) to k. By the corollary of Wilson's theorem if m is prime, p%m returns 1, and if not, it returns 0.
Once k reaches n, we found q, the nth prime that contains n.
We're in the next call during the check, so m = q + 1. k/n will return 1, and the bitwise operators -~ will increment that number once for every function call. Since it takes q - 1 calls to f to increment m from 2 to q + 1, the outmost call to f will return 1 + q - 1 = q, as intended.

Bash, 27 bytes
primes 0|grep $1|sed $1q\;d

primes comes from bsdgames.
Takes input as a command line argument, and outputs on STDOUT.

Jelly, 13 bytes
×ÆP,³Dœṣ/Ṗµ#Ṫ

Try it online!

Mathematica, 75 bytes
Nest[NestWhile[b=NextPrime,b@#,!StringContainsQ@@ToString/@{#,a}&]&,1,a=#]&

May still be golfable.

This is probably the fastest solution since it uses NextPrime :)

Java, 194 180 173 171 112 Bytes
Code:
a->{int i=1,j,n,r=0;for(j=n=new Integer(a);(r+=++i>=j&(""+j).contains(""+n)?1:0)!=n;j+=j%i==0?i=1:0);return j;}

Ungolfed:
class P{
    static int i=1,j,n,r;
    public static void main(String[]s) {
        for(
                j=n=new Integer(s[0]); //executes once before first iteration
                (r+=++i>=j&(""+j).contains(""+n)?1:0)!=n; //executes on first and every iteration
                j+=j%i==0?i=1:0 //executes after first and every iteration
           ) {
            ;
        }
        System.out.print(j);
    }
}

Hi, welcome to PPCG! Two things to note, 1. You can remove two spaces at P { and String[] s. And 2. you are currently only giving the output for 10, but the code-golf challenge was to take an input n and give the proper output based on that input. Also, you might find this interesting: Tips for golfing in Java.

MATL, 18 bytes
`@YqVGVXf?3M]NG<]&

Try it online!
Explanation
This generates primes in order using a do...while loop. For each prime, the condition is tested (and the prime is consumed). If satisfied, that prime is pushed to the stack again. The number of elements in the stack is used as count of how many qualifying primes we have found. When there are enough of them, the last one is displayed.
`         % Do...while
  @       %   Push iteration index, k. Starts at 1
  YqV     %   k-th prime. Convert to string
  GV      %   Push input, n. Convert to string
  Xf      %   Find string within another
  ?       %   If non-empty
    3M    %     Push k-th prime again (increase stack size by 1)
  ]       %   End if
  NG<     %   Is stack size less than input number? If so proceeed with
          %   a new iteration; else exit do...while loop
]         % End do...while
&         % Implicitly display only top number in the stack

Ruby, 62 61 bytes
->i{Prime.lazy.map(&:to_s).grep(/#{i}/).first(i)[-1]}

Requires the -rprime flag (+8 bytes).
->i{            # lambda with one argument
Prime           # iterator over all primes
.lazy           # make the iterator lazy (can't evaluate infinite primes)
.map(&:x.to_s)  # convert the primes to strings
.grep(/#{i}/)   # find primes that regex match on the input (contain it)
.first(i)       # take the first (input) primes that satisfy this
[-1]            # take the last of those
}

Julia, 61 60 bytes
f(n,k=0,m=1)=k<n&&f(n,k+isprime(m)contains("$m","$n"),m+1)+1

Try it online!

Pyke, 15 bytes
Q.fD_P.I`Q`R{(e

Try it here!

Bash + GNU coreutils, 66 Bytes
In contrast to @Doorknob's solution, this one only needs things that are installed on every GNU/Linux:
for((n=2;;n++)){
[ `factor $n|wc -w` -eq 2 ]&&grep $1<<<$n&&exit
}

seq 1e20|factor|grep -Po "(?<=: )\d*$2\d$"|sed $1q\;d

@DigitalTrauma, my brain does not work this way ;-)

Does it need the newlines?

After for((...)){, there must be a space or newline, so it does not matter. Before the closing }, there must be a ;  or a newline, so it does not matter either.

Java 8, 192 183 181 171 bytes (full program)
interface M{static void main(String[]a){long n=new Long(a[0]),c=0,r=1,m,i;for(;c<n;c+=m>1&(r+"").contains(a[0])?1:0)for(m=++r,i=2;i<m;m=m%i++<1?0:m);System.out.print(r);}}

Try it online.
Explanation:
interface M{                    // Class
  static void main(String[]a){  //  Mandatory main-method
    long n=new Long(a[0]),      //   Input argument as number
         c=0,                   //   Counter, starting at 0
         r=1,                   //   Result-number, starting at 1
         m,i;                   //   Temp number
    for(;c<n;                   //   Loop as long as `c` does not equals `n`
        c+=                     //     After every iteration: increase `c` by:
           m>1                  //      If the current `r` is a prime,
           &(r+"").contains(a[0])?
                                //      and this prime contains the input `n`
            1                   //       Increase `c` by 1
           :                    //      Else:
            0)                  //       Leave `c` the same
      for(m=++r,                //    Increase `r` by 1 first with `++r`, and set `m` to it
          i=2;i<m;              //    Inner loop `i` in the range [2, `m`)
        m=m%i++<1?              //     If `m` is divisible by `i`
           0                    //      Change `m` to 0 (so it's not a prime)
          :                     //     Else:
           m);                  //      Leave `m` unchanged
    System.out.print(r);}}      //    Print `r` as result

Java 8, 105 bytes (lambda function)
n->{int c=0,r=1,m,i;for(;c<n;c+=m>1&(r+"").contains(n+"")?1:0)for(m=++r,i=2;i<m;m=m%i++<1?0:m);return r;}

Try it online.
Same as above, but with n as integer input and without the verbose class stuff.

you can replace && with & and remove ? from your regexp.

@cliffroot Thanks, edited the post. I always forget about && and & for some reason..

Perl 6, 41 bytes
->$n {grep({.is-prime&&/$n/},2..*)[$n-1]}

Explanation:
-> $n { # has one parameter
  grep(
    {
      .is-prime # check that it is prime
      &&        # and
      / $n /    # that it contains the argument in the "string"
    },
    2 .. *      # for all numbers starting with 2
  )[ $n - 1 ]   # only take the $n-th one
                # ( accounting for 0 based array access )
}

Test:
#! /usr/bin/env perl6
use v6.c;
use Test;

my &prefix:<ℙ> = ->$n {grep({.is-prime&&/$n/},2..*)[$n-1]}

my @test = (
  1  => 11,
  2  => 23,
  3  => 23,
  10 => 1033,
);

plan +@test;

for @test {
  is ℙ.key, .value, .gist
}

1..4
ok 1 - 1 => 11
ok 2 - 2 => 23
ok 3 - 3 => 23
ok 4 - 10 => 1033

Japt -h, 15 13 11 bytes
_j ©ZsèU}jU

Try it

Husk, 10 bytes
!fo`€d¹dİp

Try it online!
Explanation
!fo`€d¹dİp
 fo     İp filter the infinite list of primes by the following:
     d¹    are the digits of n
   `€      a sublist of('`' switches the arguments)
       d   the digits of the number?
!          get nth element

Stax, 14 13 bytes
éâ^^εîï5~8<IM

Run and debug it
A good question for a generator.
-1 byte from recursive.
Explanation
Z{|p_$yI^*}{gnH input: single number, n
             n  generator mode: count(stops after n values are found)
Z               push a 0 under the input(start value)
 {        }     filter block:
  |p            number is prime?
         *      and
    _$          string representation of number
      yI^       contains n?
           {g   generator block:
                implicit increment to get next number
              H get last generated value

Haskell, 97 bytes
import Data.List
p n=[z|z<-[2..],all((>0).mod z)[2..z-1],show n`elem`subsequences(show z)]!!(n-1)

Try it online!
"subsequences" is an annoyingly long word.
Thanks to @xnor for saving a byte.

It looks like you have a stray space before the |

@xnor Thanks for spotting that I'd left that in; I had to add it because my IDE thought the list comprehension was a quasiquote without the space (probably a bug, now I think about it).

Vyxal, 8 bytes
‹Þp'?c;i

Try it Online!

Clojure, 118 bytes
(defn s[n](nth(filter(fn[x](if(.contains(str x)(str n))(not-any? #(=(mod x %)0)(range 2 x))))(drop 2(range)))(dec n)))

Just gets the nth element of lazy infinite sequence of numbers which are prime and have n in their string representation.
You can try it here : https://ideone.com/ioBJjt

PowerShell v2+, 108 99 bytes
Ooof. The lack of any sort of built-in prime calculation/checking really hurts here.
param($n)for(){for(;'1'*++$i-match'^(?!(..+)\1+$)..'){if("$i"-like"*$n*"){if(++$o-eq$n){$i;exit}}}}

Takes input $n, enters an infinite for() loop. Each iteration, we use a for loop wrapped around the PowerShell regex prime checker (h/t to Martin) to turn it into a prime generator by incrementing $i each time through the loop. (For example, running just for(){for(;'1'*++$i-match'^(?!(..+)\1+$)..'){$i}} will output 2, 3, 5, 7... separated by newlines).
Then a simple -like check to see if $n is somewhere in $i, and increment our counter $o. If we've reached where $n and $o are equal, output $i and exit. Otherwise we continue through the for to find the next prime and the process repeats.

Actually, 16 bytes
;$╗`P$╜@íu`╓dP.X

Try it online!
Explanation:
;$╗`P$╜@íu`╓dP.X
;$╗               make a copy of n, push str(n) to reg0
   `      `╓      push the first n values where f(k) is truthy, starting with k=0:
    P$              kth prime, stringified
      ╜@íu          1-based index of n, 0 if not found
            d     remove last element of list and push it to the stack (dequeue)
             P    nth prime
              .   print
               X  discard rest of list

APL(NARS), 39 chars, 78 bytes
{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}

1π is the next prime number...; test:
  f←{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
  f¨1 2 3 10
11 23 23 1033

but that already at 20 goes out the stack space...
Instead this below seems ok even if has lenght a little more long (61 chars)
∇r←f w;i;k;s
r←2⋄s←⍕w⋄i←1
→0×⍳(w≤i)∧k←∨/s⍷⍕r⋄r←1πr⋄i+←k⋄→2
∇

  f¨1 2 3 10 20 100
11 23 23 1033 4201 100999

Add++, 36 bytes
L,5*2^RßÞPABDBJVB]dG€Ωezß£*BZB]A1_$:

Try it online!
Fairly inefficient. Iterates over each integer \$i\$ such that \$i \le 25x^2\$ and filters out composites and primes that don't contain \$n\$. Finally, we take the \$n\$th value of the remaining integers.

source: Stack Exchange

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

sort: votes


text:
Hi, can you draw some odd art? Bye!
Create a program that outputs "Hi, Hello!" in k bytes. By altering n bytes, the code should output all odd numbers in the range 5 <= x <= 25.
Changing another m bytes should result in a code that prints the following frame in ASCII-art:
+-+
| |
+-+

Change another o bytes, and print Hello, bye!.
m, n and o are calculated in Levenshtein distance (cumulative). n is the distance from the first to the second code. m is the distance between the second and third and so on.
The score of your submission will be 0.5*k + n + m + o.
As an example:
The code that prints `Hi, Hello!` is 30 bytes.              15
Add two bytes and remove one and print the odd numbers     + 3
Alter three bytes in place, and add one to print the box   + 4
Remove four bytes and print `Hello, bye!`                  + 4
Total score:                                                26

Rules

All codes must be in the same language
You have to follow the given order (i.e. the first code prints Hi, Hello, the second prints the numbers etc.)
The strings and ASCII-box must be exactly as specified. The list of digits can be on any suitable format

One small point is that "Hello, bye!" (the longer of the 2 strings) is only 13 bytes even with the quotes, giving savings of 6.5 when you remove it, and the distance between it and the other string is 9, making it worthless to take it out.

You could use 6 bytes extra to have "Hi, Hello!, bye!" or something in there in the original code, thus 3 extra "points". You need a byte to comment it out, but you might be able to combine it with another comment somehow. Comment it in and out would only cost a byte or two. Some commenting is probably necessary anyway, so it is might be possible to get those extra bytes "cheaper".

@StewieGriffin so this was my last :-( FWIW, I've found many of your previous challenges very good. This one may not be the best, but I don't see why it has so many downvotes

Jelly, 23
First program, 40 bytes
“"©ĊĠȦẋạ»
5r25m2
“+-+¶| ”ȮṖṚ
“(ʠƤ,ụȤ»
1£

Try it online!
Second program, edit distance 1
“"©ĊĠȦẋạ»
5r25m2
“+-+¶| ”ȮṖṚ
“(ʠƤ,ụȤ»
2£

Try it online!
Third program, edit distance 1
“"©ĊĠȦẋạ»
5r25m2
“+-+¶| ”ȮṖṚ
“(ʠƤ,ụȤ»
3£

Try it online!
Fourth program, edit distance 1
“"©ĊĠȦẋạ»
5r25m2
“+-+¶| ”ȮṖṚ
“(ʠƤ,ụȤ»
4£

Try it online!
How it works
In all Jelly programs, every line defines a link. The last one is the main link and is executed automatically by the interpreter.
The quick £ inspects the number before it and calls the link on that line, so it suffices to place the four individual programs on different lines and call the appropriate one.
First program
“"©ĊĠȦẋạ»

This simply uses Jelly's built-in compression, constructing the string as Hi, (bare string), Hello (dictionary word) and ! (bare string).
Second program
5r25m2

5 sets the left argument to 5, r25 creates a range up to 25 and m2 selects every second element.
Third program
“+-+¶| ”ȮṖṚ

“+-+¶| ” sets the left argument to that string, Ȯ prints it explicitly, Ṗ removes the last character and Ṛ reverses the result. The reversed string gets printed implicitly.
Fourth program
“(ʠƤ,ụȤ»

Akin to the first program, this compresses the output string as Hello (dictionary word), , (bare string), bye (dictionary word, leading space) and ! (bare string).

05AB1E, 42 ÷ 2 = 21 + 1 + 1 + 1 = 24
Hi, Hello code:
”Hi,Ÿ™!”25ÅÉ¦¦"+-+
"©"| |
"®««“Ÿ™,Þ¡!“ª\\\

Try it online!.

Odd numbers code:
”Hi,Ÿ™!”25ÅÉ¦¦"+-+
"©"| |
"®««“Ÿ™,Þ¡!“ª\\

Try it online!.

Box code:
”Hi,Ÿ™!”25ÅÉ¦¦"+-+
"©"| |
"®««“Ÿ™,Þ¡!“ª\

Try it online!

Hello, bye code:
”Hi,Ÿ™!”25ÅÉ¦¦"+-+
"©"| |
"®««“Ÿ™,Þ¡!“ª

Try it online!.
Uses CP-1252 encoding.

I had a few golf suggestions to golf it to score 19.5, but ended up posting it as a separated answer.

Pyth - 49 46 44/2 + 1 + 1 + 1 = 25
Hello code:
h["Hi, Hello!":5lG2"+-+
| |
+-+""Hello, bye!

Odd numbers code:
ht["Hi, Hello!":5lG2"+-+
| |
+-+""Hello, bye!

Box code:
htt["Hi, Hello!":5lG2"+-+
| |
+-+""Hello, bye!

Bye Code:
httt["Hi, Hello!":5lG2"+-+
| |
+-+""Hello, bye!

@ev3commander I just make a list containing all the outputs and then take the first element of it. t removes the first element of a list, so by adding multiple ts, I can get the output I want with a distance of only 1.

J, 33 31
3{(a,', bye!');(<' ');(>:+:i.13);'Hi, ',(a=:'Hello'),'!'
2{(a,', bye!');(<' ');(>:+:i.13);'Hi, ',(a=:'Hello'),'!'
1{(a,', bye!');(<' ');(>:+:i.13);'Hi, ',(a=:'Hello'),'!'
0{(a,', bye!');(<' ');(>:+:i.13);'Hi, ',(a=:'Hello'),'!'

We select the element from the boxed list that we need.
Old solution, 33 bytes
'Hi, Hello!'
'Hi']>:+:i.13
'Hi']<' '
'Hello, bye!'

Calculated here, requires ES6 browser
'Hi, Hello!'    12 / 2 = 6
'Hi']>:+:i.13    + l.d. 10
'Hi']<' '        + l.d.  8
'Hello, bye!'    + l.d.  9
                      = 33

Requires the console interpreter for 'Hi']<' ', which uses the fact that displayed boxed items use the required ASCII border; we just box a space in this case.

Bonus code in jolf:
u+~:/lFx2~m]x0_1d~LH.xhS

Just call this with an array containing your solutions to calculate the scores! Alternatively, open up the console and type in:
jolf("u+~:/lFx2~m]x0_1d~LH.xhS", ["p1", "p2", "p3", "p4"]);

Why does it require a es6 browser unless you didn't transpire with Babel ;_;

@Downgoat that particular solution uses guillemots, which transpire to graves, an es6 feature

Fuzzy Octo Guacamole, 58/2 + 1 + 1 + 1 = 32 byte-points
"Hi, Hello!""Hello, bye!"%@0{25*!5[X2a]@}"+-+"X"| |"X"+-+"

This code as-is prints Hi, Hello!.  By changing the % to a space ( ), you get Hello, bye!. By changing the first @ to a space ( ), you get the list of odd numbers, starting with 5 and ending with 25.. And finally, by changing the 0 to a space,  , you get +-+\n| |\n+-+.
The 4 pieces of code (iterated removals):
"Hi, Hello!""Hello, bye!"%@0{25*!5[X2a]@}"+-+"X"| |"X"+-+"
"Hi, Hello!""Hello, bye!" @0{25*!5[X2a]@}"+-+"X"| |"X"+-+"
"Hi, Hello!""Hello, bye!"  0{25*!5[X2a]@}"+-+"X"| |"X"+-+"
"Hi, Hello!""Hello, bye!"   {25*!5[X2a]@}"+-+"X"| |"X"+-+"

What the FOG is this language? Lame pun aside, a link to its specification would be nice :)

@Aaron sure, I'll add that.

You dirty upvote beggar ! "/s"

Haskell, 41
"Hi, Hello!"
--[5,7..25]
--"+-+\n| |\n+-+"
--"Hello, bye!"

--"Hi, Hello"
[5,7..25]
--"+-+\n| |\n+-+"
--"Hello, bye!"

--"Hi,Hello"
--[5,7..25]
"+-+\n| |\n+-+"
--"Hello, bye!"

--"Hi,Hello"
--[5,7..25]
--"+-+\n| |\n+-+"
"Hello, bye!"

The initial program is 58 bytes, i.e. a score of 29. Each of the successors adds -- and removes -- for a score of 4, so the total is 29 + 3*4 = 41.
Haskell 33.5
If returning the list of numbers as a String, i.e. "[5,7,9,11,13,15,17,19,21,23,25]" is fine, then
["Hi, Hello!",show[5,7..25],"+-+\n| |\n+-+","Hello, bye!"]!!0
["Hi, Hello!",show[5,7..25],"+-+\n| |\n+-+","Hello, bye!"]!!1
["Hi, Hello!",show[5,7..25],"+-+\n| |\n+-+","Hello, bye!"]!!2
["Hi, Hello!",show[5,7..25],"+-+\n| |\n+-+","Hello, bye!"]!!3

works for 61/2 + 1 + 1 +1 = 33.5

I kinda miss a main = print … to make a program.

@Bergi: "program" usually means program or function. For programs we use the term "full program".

Oh right, but I still miss the print for output. Or do you mean that your expressions are zero-arity functions whose result is printed when ran with GHCI? :-)

@Bergi: Functions may output via their return value.

Octave, 34
Managed to get it down to 62 bytes. A Levenshtein distance of 3 takes the score up to 34.
disp({'Hi, Hello!',["+-+\n| |\n+-+"],5:2:25,'Hello, bye!'}{1})

Using double quoted strings, we can use the newline character \n instead of the ASCII value 10.
Tests:
disp({'Hi, Hello!',["+-+\n| |\n+-+"],5:2:25,'Hello, bye!'}{1})
Hi, Hello!

disp({'Hi, Hello!',["+-+\n| |\n+-+"],5:2:25,'Hello, bye!'}{2})
+-+
| |
+-+

disp({'Hi, Hello!',["+-+\n| |\n+-+"],5:2:25,'Hello, bye!'}{3})
5    7    9   11   13   15   17   19   21   23   25

disp({'Hi, Hello!',["+-+\n| |\n+-+"],5:2:25,'Hello, bye!'}{4})
Hello, bye!

JavaScript, 80 ÷ 2 + 1 + 1 + 1 = 43
_=>[`Hi, Hello!`,`5 7 9 11 13 15 17 19 21 23 25`,`+-+
| |
+-+`,`Hello, bye!`][0]

Change the 0 to 1, 2, or 3 as appropriate. I tried generating the odd numbers but that cost me a byte.

Python 3, 69/2 + 1 + 1 + 1 = 37.5 points.
It's the same approach as the other answers, but in Python.
print(['Hi, Hello!',*range(5,27,2),'+-+\n| |\n+-+','Hello, bye!'][1])

Change the number to the one you want for a distance of 1.

Python 2, 66 / 2 + 1 + 1 + 1 = 36
Python 3 answer by @MorganThrapp
Hi, Hello!

print('Hi, Hello!',range(5,26,2),'+-+\n| |\n+-+','Hello, bye!')[0]

[5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]

print('Hi, Hello!',range(5,26,2),'+-+\n| |\n+-+','Hello, bye!')[1]

+-+
| |
+-+

print('Hi, Hello!',range(5,26,2),'+-+\n| |\n+-+','Hello, bye!')[2]

Hello, bye!

print('Hi, Hello!',range(5,26,2),'+-+\n| |\n+-+','Hello, bye!')[3]

Can you use a list comprehension for the odd numbers? And why not range?

@EᴀsᴛᴇʀʟʏIʀᴋ It's actually longer than you think.

Actually, can't you use range(5,26,2)? You don't need the list comprehension in python 2.

@EᴀsᴛᴇʀʟʏIʀᴋ yep.

Mathematica, 74/2+1+1+1 = 40
s=##<>"!"&;s["Hi, ",h="Hello"][2Range@11+3,"+-+
| |
+-+",h~s~", bye"][[0]]

Creates a list whose elements are the four outputs, and then selects list element 0 to produce the first output; that 0 can be changed to 1, 2, or 3 to produce the other outputs. (The odd integers from 5 to 25 are output as a list.) Saved one byte by using the golfing trick where the head of a "list" is its element 0. Also saved a few bytes by defining a function s that concatenates its two arguments and adds an exclamation point, which allows me to reuse "Hello".

05AB1E (legacy), score: 19.5 18.5 (31 bytes / 2 + 1 + 1 + 1)

“Ÿ™,Þ¡!“ª"+-+\n| "ûTÝ·5+”ŒÞ,Ÿ™!” - try it online;
“Ÿ™,Þ¡!“ª"+-+\n| "ûTÝ·5+”ŒÞ,Ÿ™!”\ - try it online;
“Ÿ™,Þ¡!“ª"+-+\n| "ûTÝ·5+”ŒÞ,Ÿ™!”\\ - try it online;
“Ÿ™,Þ¡!“ª"+-+\n| "ûTÝ·5+”ŒÞ,Ÿ™!”\\\ - try it online.

Based on @Adnan's 05AB1E (legacy) answer, but further golfed. Since Adnan isn't really active anymore, I decided to post it as a separated answer.
Explanation:
“Ÿ™,Þ¡!“ª   # Fourth output:
“Ÿ™,Þ¡!“    #  Push dictionary string "hello, bye!"
        ª   #  Sentence capitalize it: "Hello, bye!"
"+-+\n| "û  # Third output:
"+-+\n| "   #  Push string "+-+\n| "
         û  #  Palindromize it to "+-+\n| |\n+-+"
TÝ·5+       # Second output:
TÝ          #  Push list [0,1,2,3,4,5,6,7,8,9,10]
  ·         #  Double each: [0,2,4,6,8,10,12,14,16,18,20]
   5+       #  Increase each by 5: [5,7,9,11,13,15,17,19,21,23,25]
”ŒÞ,Ÿ™!”    # First output:
”ŒÞ,Ÿ™!”    #  Push dictionary string "Hi, Hello!"
\           # (zero to three times) Discard the top of the stack
            # (implicitly output the top of the stack as result)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “Ÿ™,Þ¡!“ is "hello, bye!" and ”ŒÞ,Ÿ™!” is "Hi, Hello!".
ª (sentence capitalize) is the reason for using the legacy version of 05AB1E, since this builtin is .ª in the new version of 05AB1E.

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


text:
On the Subject of Passwords
In Keep Talking and Nobody Explodes, players are tasked with defusing bombs based on information from their "experts" (other people with a manual). Each bomb is made up of modules, one of which can be passwords, where the expert is given this list of possible passwords, all five letters long:
about   after   again   below   could
every   first   found   great   house
large   learn   never   other   place
plant   point   right   small   sound
spell   still   study   their   there
these   thing   think   three   water
where   which   world   would   write

And the player is given a list of 6 possible letters for each place in the password. Given the possible letter combinations, output the correct password. Input can be in any reasonable format (2D array, string separated by newline, etc.) You may discount the code which you use to compress/generate the list/string/array/whatever of passwords. (Thanks @DenkerAffe)
NOTE: Passwords are case insensitive. You may assume that input will only solve for one password.
Examples / Test Cases
Input here will be represented as a array of strings.
["FGARTW","LKSIRE","UHRKPA","TGYSTG","LUOTEU"] => first
["ULOIPE","GEYARF","SHRGWE","JEHSDG","EJHDSP"] => large
["SHWYEU","YEUTLS","IHEWRA","HWULER","EUELJD"] => still

Related.

I suggest allowing the list of possible passwords as input to the program. Otherwise this comes down to which language has the best string compression.

@DenkerAffe if there's already a submission, would it be better to say discount the code you use to generate the list of passwords?

It's fine if you change it; I wouldn't mind (the bulk of my submission would remain unchanged).

I agree with DenkerAffe - having the possible passwords be given as input rather than a static list makes for a much more interesting challenge.

It might simplify things if you use the list of strings as a second input, as well, since it makes it clear which bytes count. I wasn't sure whether to count the < in my Bash solution, for example.

Pyth, 13 bytes
:#%*"[%s]"5Q0c"ABOUTAFTERAGAINBELOWCOULDEVERYFIRSTFOUNDGREATHOUSELARGELEARNNEVEROTHERPLACEPLANTPOINTRIGHTSMALLSOUNDSPELLSTILLSTUDYTHEIRTHERETHESETHINGTHINKTHREEWATERWHEREWHICHWORLDWOULDWRITE"5

Test suite.
 #             filter possible words on
:           0  regex match, with pattern
  %        Q   format input as
    "[%s]"     surround each group of letters with brackets (regex char class)
   *      5    repeat format string 5 times for 5 groups of letters

You forgot to update your first code block :P

@Downgoat What did I forget to update? It looks right to me.

Odd, the first code block seems to not match the example (it appears to be an old revision?)

8 bytes

Bash, 22 bytes
grep `printf [%s] $@`< <(echo ABOUTAFTERAGAINBELOWCOULDEVERYFIRSTFOUNDGREATHOUSELARGELEARNNEVEROTHERPLACEPLANTPOINTRIGHTSMALLSOUNDSPELLSTILLSTUDYTHEIRTHERETHESETHINGTHINKTHREEWATERWHEREWHICHWORLDWOULDWRITE | sed 's/...../&\n/g')

Run like so:
llama@llama:~$ bash passwords.sh FGARTW LKSIRE UHRKPA TGYSTG LUOTEU
FIRST

      printf [%s] $@    surround all command line args with brackets
grep `              `   output all input lines that match this as a regex
                     <  use the following file as input to grep

It makes no difference to your score, but I still couldn't resist this golf: fold -5<<<ABOUTAFTERAGAINBELOWCOULDEVERYFIRSTFOUNDGREATHOUSELARGELEARNNEVEROTHERPLACEPLANTPOINTRIGHTSMALLSOUNDSPELLSTILLSTUDYTHEIRTHERETHESETHINGTHINKTHREEWATERWHEREWHICHWORLDWOULDWRITE|grep \printf [%s] $@`
`

Ruby, 48 42 39 bytes
Now that it's done, it's very similar to the Pyth solution, but without %s formatting to the point where it's basically a direct port now.
If you only output the result with puts, you don't need the [0] at the end since puts will deal with that for you.
->w,l{w.grep(/#{'[%s]'*l.size%l}/i)[0]}

With test cases:
f=->w,l{w.grep(/#{'[%s]'*l.size%l}/i)[0]}

w = %w{about after again below could
every first found great house
large learn never other place
plant point right small sound
spell still study their there
these thing think three water
where which world would write}

puts f.call(w, ["FGARTW","LKSIRE","UHRKPA","TGYSTG","LUOTEU"]) # first
puts f.call(w, ["ULOIPE","GEYARF","SHRGWE","JEHSDG","EJHDSP"]) # large
puts f.call(w, ["SHWYEU","YEUTLS","IHEWRA","HWULER","EUELJD"]) # still

JavaScript (ES6), 62 bytes
(l,p)=>p.find(w=>l.every((s,i)=>eval(`/[${s}]/i`).test(w[i])))

53 bytes on Firefox 48 or earlier:
(l,p)=>p.find(w=>l.every((s,i)=>~s.search(w[i],"i")))

Would have been 49 bytes if not for that case insensitivity requirement:
(l,p)=>p.find(w=>l.every((s,i)=>~s.search(w[i])))

f=
  (l,p)=>p.find(w=>l.every((s,i)=>eval(`/[${s}]/i`).test(w[i])))
;
p=["about","after","again","below","could","every","first","found","great","house","large","learn","never","other","place","plant","point","right","small","sound","spell","still","study","their","there","these","thing","think","three","water","where","which","world","would","write"];
o1.value=f(["FGARTW","LKSIRE","UHRKPA","TGYSTG","LUOTEU"],p)
o2.value=f(["ULOIPE","GEYARF","SHRGWE","JEHSDG","EJHDSP"],p)
o3.value=f(["SHWYEU","YEUTLS","IHEWRA","HWULER","EUELJD"],p)
<input id=o1><input id=o2><input id=o3>

Brachylog, 25 bytes
:@laL,["about":"after":"again":"below":"could":"every":"first":"found":"great":"house":"large":"learn":"never":"other":"place":"plant":"point":"right":"small":"sound":"spell":"still":"study":"their":"there":"these":"thing":"think":"three":"water":"where":"which":"world":"would":"write"]:Jm.'(:ImC,L:Im'mC)

The uncounted bytes are the array of words, including the square brackets.
Explanation
:@laL                          Unifies L with the input where each string is lowercased
     ,[...]:Jm.                Unifies the Output with one of the words
               '(            ) True if what's in the parentheses is false,
                               else backtrack and try another word
                 :ImC          Unify C with the I'th character of the output
                     ,L:Im'mC  True if C is not part of the I'th string of L

JavaScript (ES6), 71 bytes
w=>l=>w.filter(s=>eval("for(b=1,i=5;i--;)b&=!!~l[i].indexOf(s[i])")[0])

Usage:
f=w=>l=>w.filter(s=>eval("for(b=1,i=5;i--;)b&=!!~l[i].indexOf(s[i])")[0])
f(array_of_words)(array_of_letters)

Python, 64 60 57 bytes
Code to create word list w as string, words are space-separated (bytes are discounted from solution code length):
w="about after again below could every first found great house large learn never other place plant point right small sound spell still study their there these thing think three water where which world would write"

Current solution (57 bytes): saved 3 bytes thanks to @RootTwo
import re;f=lambda a:re.findall("(?i)\\b"+"[%s]"*5%a,w)[0]

This function takes a tuple (no list!) of exactly 5 strings which represent the possible letters for each password character as input.
See this code running on ideone.com

Second version (60 bytes):
import re;f=lambda a:re.findall("\\b"+"[%s]"*5%a+"(?i)",w)[0]

This function takes a tuple (no list!) of exactly 5 strings which represent the possible letters for each password character as input.
See this code running on ideone.com
First version (64 bytes):
import re;f=lambda a:re.findall("\\b["+"][".join(a)+"](?i)",w)[0]

This function takes any iterable (e.g. list or tuple) of exactly 5 strings which represent the possible letters for each password character as input.
See this code running on ideone.com

Save three bytes by using this regex: "(?i)\\b"+"[%s]"*5%a

Of course, what an obvious "mistake" from my side... Thank you for pointing this out @RootTwo, I edited my answer and gave you credits.

@ByteCommander I don't see any credit at all.

@ΈρικΚωνσταντόπουλος Right below the w=... code line: "The actual solution (57 bytes, saved 3 bytes thanks to @RootTwo):"

@ByteCommander Maybe I previewed an earlier version after waking my pc up from hibernation.

Hoon, 125 bytes
|=
r/(list tape)
=+
^=
a
|-
?~
r
(easy ~)
;~
plug
(mask i.r)
(knee *tape |.(^$(r t.r)))
==
(skip pass |*(* =(~ (rust +< a))))

Ungolfed:
|=  r/(list tape)
=+  ^=  a
|-
  ?~  r
    (easy ~)
  ;~  plug
    (mask i.r)
    (knee *tape |.(^$(r t.r)))
  ==
(skip pass |*(* =(~ (rust +< a))))

Hoon doesn't have regex, only a parser combinator system. This makes it pretty complicated to get everything working: (mask "abc") roughly translates to regex's [abc], and is the core of the parser that we are building.
;~(plug a b) is a monadic bind of two parsers under ++plug, which has to parse the first and then second or else it fails.
++knee is used to build a recursive parser; we give it a type (*tape) of the result, and a callback to call to generate the actual parser. In this case, the callback is "call the entire closure again, but with the tail of the list instead". The ?~ rune tests is the list is empty, and gives (easy ~) (don't parse anything and return ~) or adds on another mask and recurse again.
Having built the parser, we can get to using it. ++skip removes all elements of the list for which the function returns yes for. ++rust tries to parse the element with our rule, returning a unit which is either [~ u=result] or ~ (our version of Haskell's Maybe). If it's ~ (None, and the rule either failed to parse or didn't parse the entire contents), then the function returns true and the element is removed.
What's left over is a list, containing only the word where each letter is one of the options in the list given. I'm assuming that the list of passwords is already in the context under the name pass.
> =pass %.  :*  "ABOUT"  "AFTER"   "AGAIN"   "BELOW"   "COULD"
   "EVERY"   "FIRST"   "FOUND"   "GREAT"   "HOUSE"
   "LARGE"   "LEARN"   "NEVER"   "OTHER"   "PLACE"
   "PLANT"   "POINT"   "RIGHT"   "SMALL"   "SOUND"
   "SPELL"   "STILL"   "STUDY"   "THEIR"   "THERE"
   "THESE"   "THING"   "THINK"   "THREE"   "WATER"
   "WHERE"   "WHICH"   "WORLD"   "WOULD"   "WRITE"
   ~  ==  limo
> %.  ~["SHWYEU" "YEUTLS" "IHEWRA" "HWULER" "EUELJD"]
  |=
  r/(list tape)
  =+
  ^=
  a
  |-
  ?~
  r
  (easy ~)
  ;~
  plug
  (mask i.r)
  (knee *tape |.(^$(r t.r)))
  ==
  (skip pass |*(* =(~ (rust +< a))))
[i="STILL" t=<<>>]

Python 3, 81 bytes
from itertools import*
lambda x:[i for i in map(''.join,product(*x))if i in l][0]

An anonymous function that takes input of a list of strings x and returns the password.
The list of possible passwords l is defined as:
l=['ABOUT', 'AFTER', 'AGAIN', 'BELOW', 'COULD',
   'EVERY', 'FIRST', 'FOUND', 'GREAT', 'HOUSE',
   'LARGE', 'LEARN', 'NEVER', 'OTHER', 'PLACE',
   'PLANT', 'POINT', 'RIGHT', 'SMALL', 'SOUND',
   'SPELL', 'STILL', 'STUDY', 'THEIR', 'THERE',
   'THESE', 'THING', 'THINK', 'THREE', 'WATER',
   'WHERE', 'WHICH', 'WORLD', 'WOULD', 'WRITE']

This is a simple brute force; I was interested to see how short I could get this without regexes.
How it works
from itertools import*  Import everything from the Python module for iterable generation
lambda x                Anonymous function with input list of strings x
product(*x)             Yield an iterable containing all possible passwords character by
                        character
map(''.join,...)        Yield an iterable containing all possible passwords as strings by
                        concatenation
...for i in...          For all possible passwords i...
i...if i in l           ...yield i if i is in the password list
:[...][0]               Yield the first element of the single-element list containing the
                        correct password and return

Try it on Ideone


text:
Divisor reduction
A divisor of a number n is any number that evenly divides n, including 1 and n itself. The number of divisors d(n) is how many divisors a number has. Here's d(n) for the first couple n:
n    divisors    d(n)
1    1           1
2    1, 2        2
3    1, 3        2
4    1, 2, 4     3
5    1, 5        2
6    1, 2, 3, 6  4

We can repeatedly subtract the number of divisors from a number. For example:
16                  = 16
16 - d(16) = 16 - 5 = 11
11 - d(11) = 11 - 2 = 9
 9 - d( 9) =  9 - 3 = 6
 6 - d( 6) =  6 - 4 = 2
 2 - d( 2) =  2 - 2 = 0

In this case it took 5 steps to get to 0.

Write a program or function that given a nonnegative number n returns the number of steps it takes to reduce it to 0 by repeated subtraction of the number of divisors.
Examples:
0, 0
1, 1
6, 2
16, 5
100, 19
100000, 7534

Obligatory OEIS link: A155043

Related.

Jelly, 10 9 bytes
1 byte thanks to Dennis ♦.
Port of my answer in Pyth.
ÆDLạµÐĿL’

Try it online!
Test suite.
Explanation
_ÆDL$$ÐĿL’
      ÐĿ    Repeat the following until result no longer unique:
 ÆD             Yield the array of the divisors
   L            Yield the length of the array
_               Subtract that from the number
        L   Number of iterations
         ’  Minus one.

Python, 49 bytes
f=lambda n:n and-~f(sum(n%~x<0for x in range(n)))

orlp helped save a byte! And Sp3000 saved two more. Thanks!

Should be able to shorten things by moving the -~ into n%-~k, and removing the lower bound of the range.

C, 52 bytes
g,o;l(f){for(g=o=f;o;f%o--||--g);return f?1+l(g):0;}

Pyth, 10 bytes
tl.ulf%NTS

Test suite.
Explanation
tl.ulf%NTS
tl.ulf%NTSNQ  implicit variables at the end
           Q  obtain the input number
  .u      N   repeat the following until result no longer unique:
         S        generate range from 1 to N
     f            filter for:
      %NT             T in that range, which N%T is truthy (not zero)
    l             length of that list
                  that means, we found the number of "non-divisors" of N
tl            number of iterations, minus 1.

Julia, 31 bytes
f(n)=n<1?0:f(sum(n%(1:n).>0))+1

Straightforward recursive implementation.

JavaScript (ES6), 64 51 bytes
f=n=>n&&[...Array(m=n)].map((_,i)=>m-=n%++i<1)|f(m)+1

Don't ask me why I was unnecessarily using tail recursion.

MATL, 14 bytes
`t~?x@q.]t:\zT

Try it online!
Explanation
`            T  % Infinite loop
 t~?    ]       % Duplicate number. Is it non-zero?
    x@q.        % If so: delete number, push iteration index minus 1, break loop
         t:\    % Duplicate, range, modulo (remainder). Divisors give a 0 remainder
            z   % Number of non-zero elements; that is, of non-divisors

Java, 147 93
a->{int k,i,n=new Integer(a),l=0;for(;n!=0;n-=k)for(l+=k=i=1;i<n;)if(n%i++==0)++k;return l;}

Why n=new Integer(100000) instead of n=100000?

Hoon, 93 76 bytes
|=
r/@
?~
r
0
+($(r (sub r (lent (skim (gulf 1^r) |=(@ =(0 (mod r +<))))))))

Ungolfed:
|=  r/@
?~  r
  0
=+  (skim (gulf 1^r) |=(@ =(0 (mod r +<))))
+($(r (sub r (lent -))))

Returns a function that takes an atom, r. Create an intermediate value that contains all the devisors of r (Make list [1..n], keep only the elements where (mod r i) == 0). If r is zero return zero, else return the incremented value of recursing with r equal r-(length divisors).
The code as-is takes a stupid amount of time to evaluate for n=100.000, entirely because finding the devisors for big numbers makes a giant list and maps over it. Memoizing the divisors gets the correct output for n=10.000, but I didn't bother waiting around for 100.000

05AB1E, 12 10 bytes
Code:
[Ð>#Ñg-¼]¾

Explanation:
[           # start infinite loop
 Ð          # triplicate current number
  >#        # increase by 1 and break if true
    Ñg      # get number of divisors
      -     # subtract number of divisors from number
       ¼    # increase counter
        ]   # end loop
         ¾  # print counter

Try it online
Edit: 2 bytes saved and a bug with input 0 fixed thanks to @Adnan

Very nice! I tried to golf it a bit, and got it down to 10 bytes: [Ð>#Ñg-¼]¾. There has to be a way to get it shorter though...

@LuisMendo Yeah, it's because the D0Q# part is after the increment of the counter. The [Ð>#Ñg-¼]¾ code should work for 0 though :).

@Adnan: I tried a version based on generating all counts upto n and going from index to value at index and counting up, but didn't manage to get it shorter that way.

R, 50 bytes
Pretty simple implementation. Try it online
z=scan();i=0;while(z>0){z=z-sum(z%%1:z<1);i=i+1};i

44 bytes

PowerShell v2+, 74 67 bytes
param($n)for($o=0;$n-gt0){$a=0;1..$n|%{$a+=!($n%$_)};$n-=$a;$o++}$o

Seems pretty lengthy in comparison to some of the other answers...
Takes input $n, enters a for loop with the condition that $n is greater than 0. Each loop iteration we set helper $a, then loop through every number from 1 up to $n. Each inner loop we check against every number to see if it's a divisor, and if so we increment our helper $a (using Boolean negation and implicit cast-to-int). Then, we subtract how many divisors we've found $n-=$a and increment our counter $o++. Finally, we output $o.
Takes a long time to execute, since it's a significant for-loop construct. For example, running n = 10,000 on my machine (1yr old Core i5) takes almost 3 minutes.

Mathcad, [tbd] bytes

Mathcad byte equivalence scheme is yet to be determined.  Using a rough keystroke equivalence, the program uses about 39 "bytes".  Note that the while and for programming operators only take one keyboard operation each to input (ctl-] and ctl-shft-#, respectively) - indeed, they can only be entered this way from the keyboard.
What you see is exactly what gets put down on a Mathcad worksheet.  Mathcad evaluates the equations/programs and puts the output on the same sheet (eg, after the '=' evaluation operator or on the plot).

Haskell, 43 40 39 bytes
g 0=0;g n=1+g(sum$min 1.mod n<$>[1..n])

Simple recursive approach. Usage example: g 16 -> 5.
Edit: @Lynn saved 3 4 bytes. Thanks!

How about g(sum$signum.mod n<$>[1..n])?

Oh, and min 1 is actually one byte shorter than signum, even

MATL, 13 bytes
tX`t:\ztt]Nq&

Try it online
Explanation:
t               % Duplicate input
 X`      ]      % while loop, consumes 1 input
   t:\z         % calculates n-d(n), by counting number non-divisors
       tt       % dupe twice, for while loop condition, next iteration and to keep in stack
          Nq&   % get stack size, decrement, display that value

Mathematica, 35 bytes
If[#<1,0,#0[#-0~DivisorSigma~#]+1]&

Making use of good old DivisorSigma. @MartinBüttner notes the following alternatives:
If[#<1,0,#0[#-DivisorSum[#,1&]]+1]&
f@0=0;f@n_:=f[n-DivisorSum[n,1&]]+1

Racket - 126 bytes Down to 98 bytes  91 bytes
An extremely naive solution - could probably be cut down a lot with a decent algorithm and some lisp tricks that I don't know
(define(g x[c 0][d 0][i 2])(cond[(= x 0)c][(= i x)(g d(+ 1 c))][(=(modulo x i)0)(g x c d(+ 1 i))][else(g x c(+ 1 d)(+ 1 i))]))

Edit: explanation by request. As I said, this is an extremely naive recursive solution and can be much much shorter.
(define (g x [c 0] [d 0] [i 2]) ;g is the name of the function - arguments are x (input), c (counter for steps), d (non-divisor counter), i (iterator)
  (cond
    [(= x 0) c] ;once x gets to 0 c is outputted
    [(= i x) (g d (+ 1 c))] ;if iterator reaches x then we recurse with d as input and add 1 to c
    [(= (modulo x i) 0) (g x c d (+ 1 i))] ;checks if iterator is non divisor, then adds it to d and increments iterator
    [else(g x c (+ 1 d) (+ 1 i))])) ;otherwise just increments iterator

Edit 2: 98 byte version with a less dumb algorithm (still pretty dumb though and can be shorter)
(define(g x)(if(< x 1)0(+ 1(g(length(filter(λ(y)(>(modulo x y)0))(cdr(build-list x values))))))))

Explanation:
(define (g x) ;function name g, input x
  (if (< x 1)
      0 ;returns 0 if x < 1 (base case)
      (+ 1 ;simple recursion - adds 1 to output for each time we're looping
         (g (length ;the input we're passing is the length of...
              (filter (λ (y) (> (modulo x y) 0)) ;the list where all numbers which are 0 modulo x are 0 are filtered out from...
                             (cdr (build-list x values)))))))) ;the list of all integers up to x, not including 0

Edit 3: Saved 7 bytes by replacing (cdr(build-list x values)) with (build-list x add1)
(define(g x)(if(< x 1)0(+ 1(g(length(filter(λ(y)(>(modulo x y)0))(build-list x add1)))))))

Hello, and welcome to PPCG! Great post! Can you explain your solution please? (P.S. I love Lisp!)

@NoOneIsHere Edited in

APL, 22 bytes
{2>⍵:⍵⋄1+∇⍵-0+.=⍵|⍨⍳⍵}

><>, 52+2 = 54 bytes
The input number needs to be present on the stack at program start, so there's +2 bytes for the -v flag. Try it online!
:0)?v~ln;>~$-]
03[}\::
@@:$<    v?=0:-1}+{~$?@@01%@:

4 annoying bytes wasted on alignment issues. Bah.
This one works by building the sequence from n to 0 on the stack. Once 0 has been reached, pop it and ouput the length of the remaining stack.
By the way , it runs in O(n^2) time, so I wouldn't try n = 100000...

-v is one byte, not two.

><>, 36 + 3 = 39  bytes
:?v~ln; >~&
:}\0&
+&>1-:?!^:{:}$%0)&

The implementation's relatively straightforward, with each iteration being sum(n%k>0 for k in range(1,n-1)). +3 bytes for the -v flag, per meta.
Try it online!

Perl 5, 40 bytes
sub f{@_?(1,f((1)x grep@_%$_,1..@_)):()}

Input and output are as lists of the requisite number of copies of 1.

Ruby, 42 bytes
f=->n{n<1?0:1+f[n-(1..n).count{|i|n%i<1}]}

There's a stack overflow error on the largest test case 100000, so here's an iterative version within 49 bytes. Takes a while, though, considering the O(N^2) complexity.
->n{c=0;c+=1 while 0<n-=(1..n).count{|i|n%i<1};c}

C#, 63 bytes
int F(int n)=>n<1?0:F(Enumerable.Range(1,n).Count(i=>n%i>0))+1;

Actually, 17 bytes
";╗R`╜%`░l;"£╬klD

Try it online! (note: last test case times out on TIO)
Explanation:
";╗R`╜%`░l;"£╬klD
"          "£╬     while top of stack is truthy, call the function:
 ;╗                  push a copy of n to reg0
   R                 range(1,n+1) ([1,n])
    `  `░l             push the number of values where the following is truthy:
     ╜%                  k mod n
                       (this computes the number of non-divisors of n)
          ;            make a copy
              klD  push entire stack as list, count number of items, subtract 1
                   (the result is the number of times the function was called)

Husk, 9 bytes
←LU¡Ṡ-oLḊ

Try it online!

Japt, 8 bytes
©ÒßU-â l

Try it
Or 9 bytes without recursion:
©@µâ l}f1

Try it

Vyxal l, 5 bytes
≬KL-İ

Try it Online!
Flagless:
Vyxal, 6 bytes
≬KL-İL

Try it Online!


text:
Largest Distinctly Sum-Free Partition
related and inspired by -- Finding sum-free partitions
A set A is defined here as being distinctly sum-free if

1) it consists of at least three elements, |A| ≥ 3, and
2) its distinct self-sum A + A = { x + y | x, y in A} (with x,y distinct, i.e., x≠y) has no elements in common with A.

(Obsolete - do not use this going forward. Left here only because some answers may have used it. It does not match with the above conditions. Alternatively, the equation x + y = z has no solution for x,y,z ∈ A (again with x,y,z distinct, i.e., x≠y, x≠z, y≠z).)
For a simple example, {1,3,5} is distinctly sum-free, but {1,3,4} is not. {1,3} and {3} are also not, since they're not at least three elements.
The challenge here is to find the largest distinctly sum-free subset of the given input.
Input

An unordered set A of integers in any convenient format.
The integers could be positive, negative, or zero, but can be assumed to fit in your language's native [int] datatype (or equivalent).
The set is guaranteed to have only distinct elements (no multisets here).
The set is not necessarily sorted.

Output

The largest subset of A (which could be A itself), that is distinctly sum-free. Output can be in any suitable format.
If no such subset exists, output an empty set or other falsey value.
If multiple subsets are tied for largest, output any or all of them.
The subset does not necessarily need be sorted, or in the same order as the input. For example, for input {1,3,5} output {5,1,3} is acceptable.

Additional Rules

Standard loopholes are forbidden.
This is code-golf, so all usual golfing rules apply, and the shortest code wins.

Examples
Input     -> Output (any or all)
{0}       -> {}
{1, 2, 3} -> {}
{1, 3, 5} -> {1, 3, 5}
{1, 2, 3, 4, 5} -> {1, 2, 5}  {1, 2, 4}  {1, 3, 5}  {2, 3, 4}  {2, 4, 5}  {3, 4, 5}
{-5, 4, 3, -2, 0} -> {-5, 4, 3}  {-5, 4, -2}  {4, 3, -2}
{-5, 4, 3, -2} -> {-5, 4, 3}  {-5, 4, -2}  {4, 3, -2}
{-17, 22, -5, 13, 200, -1, 1, 9} -> {-17, 22, -5, 13, 200, -1, 1}  {-17, 22, -5, 200, -1, 1, 9}  {-17, -5, 13, 200, -1, 1, 9}

Jelly, 17 bytes
8BḊ+œc2S€f
ŒPÇÐḟṪ

Try it online! or verify all test cases.

MATL, 47 43 bytes
nW:qB!ts2#Sw2>)PZ)"1G@)XJ2XN!"@sJ@X-m~*]?J.

Try it online!
Explanation
This uses two loops: an outer loop to generate all possible subsets, and an inner loop to take all pairs of elements and see if the sum equals any other element of the subset.
Subsets of at least 3 elements are tested in order of decreasing number of elements. The code stops as soon as a valid subset is found.
          % Take input implicitly
nW:q      % Generate [0 1 ... 2^n-1] where n is input length
B!        % Convert to binary. Gives a matrix. Each number corresponds to a column.
          % This will be used to select the elements of each subset
ts        % Duplicate. Sum of each column
2#S       % Sort. Output the sorted array and the indices of the sorting. Each index
          % corresponds to one possible subset
w2>       % Swap. Logical index of values that exceed 2. This is used to pick only
          % subsets of more than 2 elements
)         % Keeps only indices of subsets that have at least 3 elements
P         % Flip. This moves subsets with more elements to the front. As soon as a
          % subset fulfills the condition the outer loop will be exited, so we need
          % to start with the bigger subsets
Z)        % Index into columns of binary matrix. Each column is the binary pattern
          % defining a subset with at least 3 elements, starting with bigger subsets
"         % For each column. Each iteration corresponds to a subset
  1       %   Push 1
  G@)     %   Pick actual elements of each subset (logical index into input)
  XJ      %   Copy to clipboard J
  2XN!    %   All pairs of 2 elements from that subset. Each pair is a column
  "       %   For each column. Each iteration corresponds to a pair of elements
    @s    %     Sum of those two elements
    J@X-  %     Array with the other elements (obtained with set difference)
    m~    %     True if the sum of the two elemens is not a member of the array
    *     %     Multiply. Corresponds to logical AND
  ]       %   End for
  ?       %   If result is true: no sum of two elements equalled any element
    J     %     Push found subset (will be displayed implicitly)
    .     %     Exit loop
          %   End if implicitly
          % End for implicitly
          % Display stack implicitly

Python, 137 bytes
A naïve approach. Loops over all subsets of the input containing at least 3 values, checking the property for each one. Returns [] when no result is found or [S] if at least one result is found (where S is some tuple).
from itertools import*
lambda a:[c for n in range(3,len(a)+1)for c in combinations(a,n)if all(x+y-z for(x,y,z)in permutations(c,3))][-1:]

Ruby, 107 bytes
Input is an array. Collects one qualifying subset for each subset size from 3 to the input length, then returns the biggest one out of the ones found. Returns nil if no result is found.
Because of the conflicting spec, there are two solutions that currently have the same bytecount.
Using the first definition: ({ x + y | x, y ∈ A } ∩ A = ∅)
->s{((3..s.size).map{|i|s.combination(i).find{|e|e.combination(2).map{|a,b|a+b}&e==[]}}-[p])[-1]}

Using the second definition (∀ x, y, z ∈ A: x + y ≠ z)
->s{((3..s.size).map{|i|s.combination(i).find{|e|e.permutation(3).all?{|a,b,c|a+b!=c}}}-[p])[-1]}

Javascript 246 263
a=>([...Array(1<<(l=a.length))].map((x,i)=>i.toString(2)).filter(n=>/1.*1.*1/.test(n)).map(s=>('0'.repeat(l)+s).slice(-l).replace(/./g,(b,p)=>+b&&o.push(a[p]),o=[])&&o).filter(u=>u.every((x,i)=>!u.some((y,j)=>j-i&&u.some((z,k)=>k-j&&!(z-x-y))))))

So long :( ... But it was a nice coding ..(I think)
Less golfed:

f=a=>(
    [...Array(1<<(l=a.length))]
        .map((x,i)=>i.toString(2))
        .filter(n=>/1.*1.*1/.test(n))
        .map(s=>
            ('0'.repeat(l)+s).slice(-l).replace(/./g,
                (b,p)=>+b&&o.push(a[p])
            ,o=[])&&o
        )
        .filter(u=>
            u.every((x,i)=>
                !u.some((y,j)=>
                    j-i&&u.some((z,k)=>k-j&&!(z-x-y))
                )
            )
        )
)

document.body.innerHTML = JSON.stringify( f([1,2,3,4,5]), null, 1 );

Mathematica - 89 84 83 77 76 bytes
6 bytes saved thanks to @Sp3000
Probably can be golfed a lot more, is there a shorter way to filter?
Select[Subsets@#,Length@#>2&&Intersection[#,Tr/@#~Subsets~{2}]=={}&]~Last~0&

Anonymous function, returns 0 on no answer.

Pyth, 27 bytes
ef!f!*Fm-Fd.pYfqlY3yTfglT3y

Test suite.

How does this work? I seem to get unexpected output when running it on TIO.

Sorry, fixed it now.

Doesn't work for the input 1,3,5,100, since it also prints the subset 1,3,5 which is not maximal.

A working (and much shorter) solution would be: ef&ttT!@TsM.cT2y

@Jakube Drop the initial e and then post as a separate solution :D

We have to print the largest subset,  or all the largest subsets. So the e is required.

This is still invalid, as Jakube stated.


text:
The Nine Pattern
Introduction
I stumbled across this (useless) pattern the other day while I was watching TV.
I named it "the 9 pattern" because the first number to use it was 9.
The gist of it is, you enter a number (let's say x), and then you get back:

x
x + (x / 3) [let's call this y]
two-thirds of y [let's call this z]
z + 1

So, if I put inside this pattern the number 9 as x, this is what would come out:

9 (9)
12 (9 + 9 / 3) [9 over 3 is 3, and 9 + 3 is 12]
8 (12 times two-thirds) [a third of 12 is 4, and 4 * 2 is 8]
9 (8 + 1 is 9)

Challenge
Write me a function (in any programming language) that takes in a number, and outputs an integer array using the pattern.
Somewhat like this psuedo-code:
function ninePattern(int myInt) returns IntegerArray {
    int iterationA = myInt + (myInt / 3);
    int iterationB = iterationA * (2 / 3);
    int iterationC = iterationB + 1;
    IntegerArray x = [myInt, iterationA, iterationB, iterationC];
    return x;
}

Clarifications
Discussions have been arousing in comments regarding the specifications of the question. This section is meant to clarify some of those.
"better to count in bytes than characters"
I picked characters because (for me, at least) it would be easier to judge. Of course, I can't change that now. (lots of answers are already posted)
"rounding"
Rounding follows this rhyme:

If it's 5 or more, raise the score
  If it's 4 or less, let it rest

Simply, put, if it is something like 4.7 or 3.85, round them to 5 and 4 respectively.
Examples
Input => Result
9 => [9, 12, 8, 9]
8 => [8, 11, 7, 8]
6 => [6, 8, 5, 6]
23 => [23, 31, 21, 22]
159 => [159, 212, 141, 142]

If, however, the numbers are something like 2.3 or 10.435446, round them to 2 and 10 respectively.
"language support"
You are free to not use functions and/or arrays IF AND ONLY IF the language of your choice does not support them.  If it does (even if it will increase your characters count), you must use them.

Must the output be an array, or are the numbers by themselves enough (like the Pyth answer)?

@David must be an array

You are free to restrict to just full programs, or just functions, but there is discussion on meta of the defaults, which gives some useful background in case it affects your decision for future challenges. By default challenges accept both, to allow more languages to compete.

There are defaults for input and output too. Again, you don't have to follow them, this is just to let you know.

I took a shot at it in brainfuck but I don't think it's possible for it to work with all numbers since brainfuck can't do floating point division. This code will work for all multiples of 9 as input (9,18,27,36,etc). Link: http://bit.ly/1Wen2Cl. (Had to shorten link because it's 1783 characters)

-1 for the arbitrary array and function requirements, which prevents languages without an array/list type or functions from competing.

Also, you should score the contestants in bytes, not in characters. We have a Sandbox, where you can get feedback on your post before it goes live.

Is y = round(x + x/3); z = round(⅔ y), or does the rounding happen only in the final step of printing the results?

What if the language does not have array? Can we use delimiters to separate them?

Another thing, counting in characters is often uninteresting, as it encourages boring base encoding of answers. In addition, you don't specify how rounding needs to be performed. Does 6.5 round to 6 or 7? What about 7.5? What about "near misses" due to floating point precision?

"Write me a function" Does this mean it's OK to write int[] aJavaMethodOrFunctionOrWhateverThatIsNotInsideAClassOrAnEnum(int i)?

@dorukayhan That's acceptable by default.

@FryAmTheEggman The usual meaning of rounding is half-up.

@Mego Many languages actually use banker's rounding by default, where if the digit before the 5 in the decimal representation of the number is even, you round down, but if it is odd you round up. In any case, I don't think it is a default that can be assumed (I've never seen anything on meta about it, anyway).

I recommend adding more examples as some of the answers indeed work with the example 9 but fail with other inputs.

I've explained some of the complaints in a new "Clarifications" section.

I'm sure you meant round to 5 and 4 instead of 4 and 3 in the clarification. Else I misunderstood maths.

@Frozn Oh, yes I did mean that! Editing now

MarioLANG, 659 621 591 582 556 543 516 458 418 401 352 308 369 bytes
rounding is quite expensive :/
Try it online
;>>[![( [( [( [( [( [<(([!)))!+(((-<>( >((+
:"==#================"===#== #=====""[ "==
)(  -[!)>>[![)  [)[<(!>)[<)) >))) [!!-[!((
 (  )"#="==#======="=#==="=<="=====##==#==<
 +  +>) )-+<>+)[!)+! +))![-[)>[ [([-[![<<:
 +  )-+ )(=""===#==#  ==#===)"=======#=====
 +  >!>)!>  !(- < !:+:))<  ))!((++)))<
 )  "#"=#===#===" ======" ===#======="
 !
=#========================

Well this was more fun than expected, this is probably not optimal but I guess i'm getting there.
Explanation time:
(for the 352 bytes version)
first we get the argument and print it :
;
:

simple enough
we then move to the bulk of the program : the division input / 3
;>>[![              [( [( [<result
:"==#======================"======
)   -[!)>>[![        [<((((!
)   )"#="==#=========="====#
+(  +>) )  +>(+)[!)+))!
+(  )-+ )  -"====#====#
+   >!>)!  >! -  <
    "#"=#  "#===="
 !
=#

which is a slightly modified conversion of the brainfuck division
[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]

which take for input
n 0 d 0 0

and give you back
0 n d-n%d n%d n/d

once we got the division we use it to get the sum of n and n/d and print it
;>>[![              [( [( [<    !+(((-<
:"==#======================"===)#====="
)   -[!)>>[![        [<((((!    >))) [!(((
)   )"#="==#=========="====#   ="=====#==:
+(  +>) )  +>(+)[!)+))!
+(  )-+ )  -"====#====#
+   >!>)!  >! -  <
    "#"=#  "#===="
 !
=#

we then need to do another division : ( 2 * ( n + n / d ) ) / 3
so we get ( 2 * ( n + n / d )
;>>[![              [( [( [<    !+(((-<
:"==#======================"===)#====="
)   -[!)>>[![        [<((((!    >))) [!(((
)   )"#="==#=========="====#   ="=====#==:
+(  +>) )  +>(+)[!)+))! 2*2n/d>[   -[![  <
+(  )-+ )  -"====#====# ======"======#====
+   >!>)!  >! -  <            !((++))<
    "#"=#  "#===="            #======"
 !
=#

and put it with 3 back into the division
;>>[![              [( [( [<    !+(((-<
:"==#======================"===)#====="
)   -[!)>>[![        [<((((!    >))) [!(((
)   )"#="==#=========="====#   ="=====#==:
+(  +>) )  +>(+)[!)+))!      )>[   -[![  <
+(  )-+ )  -"====#====#      )"======#====
+   >!>)!  >! -  <       +++))!((++))<
    "#"=#  "#====" ===========#======"
 !
=#=================

at that point everything explose, mario is stuck in an infinite loop doing division on bigger and bigger number, forever.
and to fix that we need a way to diferenciate between the first and the second division, it end up that, oh joy, we do have a way
;>>[![              [( [( [<([!)!+(((-<
:"==#======================"==#)#====="
)   -[!)>>[![        [<((((!))< >))) [!(((
)   )"#="==#=========="====#)="="=====#==:
+(  +>) )  +>(+)[!)+))!!:+:)))>[   -[![  <
+(  )-+ )  -"====#====#======)"======#====
+   >!>)!  >! -  <       +++))!((++))<
    "#"=#  "#====" ===========#======"
 !
=#=================

basically we look if the x in
x 0 n d-n%d n%d n/d

is 0, if it is it mean we are on the first division
else we are on the second division, and we just print the result of the division, add 1 then print it again
and voilà easy as pie.

Welcome to PPCG!

Doesn't round to the specs provided by the question (of course, I did update it after you posted your answer, but you should at least update your answer to fit the new specs)

Done. while we are talking about test case you should add 10 to have a number that you round down on the fist operation.

Emotinomicon 99 bytes, 33 characters
,⏬➗➕⏬✖➗⏬➕

Explanation:
                                 clear output
                                 begin quote string
  ,
                                 end quote string
                                 duplicate top of stack
                                 duplicate top of stack
                                 take numeric input
                                 duplicate top of stack
                                 pop N and output as a number
                                 reverse stack
          ⏬                       pops and outputs top of stack as character
                                 reverse stack
                                 duplicate top of stack
                                 push 3 to the stack
              ➗                   divide top two elements on stack
               ➕                  add top two elements on stack
                                 duplicate top of stack
                                 pop N and output as a number
                                 reverse stack
                   ⏬              pops and outputs top of stack as character
                                 reverse stack
                                 push 2 to the stack
                      ✖           multiply top two elements on stack
                                 push 3 to the stack
                        ➗         divide top two elements on stack
                                 duplicate top of stack
                                 pop N and output as a number
                                 reverse stack
                            ⏬     pops and outputs top of stack as character
                                 reverse stack
                                 push 1 to the stack
                               ➕  add top two elements on stack
                                 pop N and output as a number

Yay for unconventional languages! :P

MATL, 14 bytes
Xot4*3/tE3/tQv

Try it Online
Pretty simple, v concatenates the stack into an array. Xo converts to an integer data-type, and all operations thereafter are integer operations.

The spec is to return an array, not the final result only.

Also lol at those flagging for deletion in <2 minutes :D

@David D: I don't think I can retract deletion votes

@David upvoted your answer as my condolences :)

Haha I don't really mind, just found it amusing

I'm pretty sure this isn't a function either, correct me if I'm wrong.

@Maltysen Maybe you're right, but I can't test it rn. Maybe the OP will give us some info?

@David it's fine then, and your program seems to pass all my checks

Cheddar, 27 bytes
b=8/9*$0
[$0,$0+$0/3,b,b+1]

$0 is variable with input. Cheddar just isn't a golfy language ¯\_(ツ)_/¯ , also this is non-competing because Cheddar's input functionality was made after this challenge.
Ungolfed:
IterationB := 8 / 9 * $0  // 8/9ths of the Input
[ $0,                     // The input
  $0 + $0 / 3,            // Input + (Input/3)
  IterationB,             // (see above)
  IterationB + 1          // above + 1
]

Tears of joy! It's gone so far! :D

Java, 86 82 84 85 characters
class c{int[]i(int I){int a=I+(I/3),b=(int)(a*(2d/3d));return new int[]{I,a,b,b+1};}}

The letter d placed right after an integer makes the integer a double.
Ungolfed:
class c{
    int[] i(int I) {
        int a = I + (I / 3),
            b = (int)(a * (2d / 3d));
        return new int[]{I, a, b, b + 1};
    }
}

Without the class (class c{} is 8 chars long), it downsizes to 76 characters:
int[]i(int I){int a=I+(I/3),b=(int)(a*(2d/3d));return new int[]{I,a,b,b+1};}

More accurate version in 110 chars (118 with the enum) - it uses floats because ain't nobody got space for casting Math#round(double):
int[]i(int I){float a=I+(I/3f),b=(a*(2f/3f));return new int[]{I,Math.round(a),Math.round(b),Math.round(b+1)};}

I think I should learn Pyth.

+1, because ya know, java

Since the code is required to be a function, is the enum really necessary?

you can remove enum keyword, as requirement is to write a function, and you could remove space between function name and type

What version of Java is this?

Java has double declarations, right? So you should be able to do 3d, 2d, 3d, etc. Also, I think you can save another 3 bytes by doing a=I*4d/3d right?

@Loovjo Java 5.0 is the oldest release that can compile this.

@dorukayhan Weird, I seem to get an error when I'm trying to run this in Eclipse, it can't convert from double to int. I'll see if I can figure out what the problem is tomorrow.

@Loovjo is right, this code doesn't even compile as you have to cast the doubles to ints.

I just fixed the code

I see but it doesn't give correct results for inputs like 8 or 10. The first addition isn't working properly as I + (I / 3) is using an integer division, meaning that fractions are discarded and thus the result isn't rounded properly.

The error happens because the numbers are ints. If they were doubles, everything would be fine. Also note that I+(I/3) == I+(int)(I/3d) == (int)(I + (I/3d) (because I is an integer, and casting a double to an int or a long simply discards the decimal places (e.g (int) 9.9 is 9, not 10)) - oh wait, I can post an longer but more accurate implementation

figures out the accurate implementation in a few minutes*

Yes that's all right but there would be no correct rounding as e.g. (int) (8 + 8 / 3d) == (int) (8 + 2.666) == 10 where as the correct solution would be to round 8+2.6666 to 11. The solution with floats looks correct, but I'm sure that you can shorten it. (I think if we go into more detail we should move that to chat)

Java, 56 80 Bytes
As some users pointed out, this solution (as some others in java) does not round data properly. So now I'm presenting slightly longer solution which should return correct result
int[]h(int a){int[]b={a,Math.round(a+a/3f),a=Math.round(a*8f/9),++a};return b;}

or 60  bytes lamda version
a->new int[]{a,Math.round(a+a/3f),a=Math.round(a*8f/9),++a}

Golfed version
int[]g(int a){int[]b={a,a+a/3,a*8/9,a*8/9+1};return b;}

and ungolfed
int[] g(int a) {
        int[] b = { a, a + a / 3, a * 8 / 9, a * 8 / 9 + 1 };
        return b;
    }

or 36 bytes defined as lambda
a->new int[]{a,a+a/3,a*8/9,a*8/9+1}

Does not have the rounding required by the Question.

As @Marv mentioned this question doesn't work correcty, e.g. for input 8 the expected result would be [8,11,7,8] but it is [8,10,7,8]

why downvote? i fixed it and it working correctly now?

Sorry for the downvote after you fixed it. The downvote is locked now, so I cannot remove it unless you make some change to your answer (any trivial change is enough)

@edc65 ok, done

Scratch, 33 bytes

(source: cubeupload.com)
Asks for input, sets a to input rounded, sets b and c to their respective changes, then says all four numbers, seperated by commas.

05AB1E, 15 bytes
Code:
Ð3/+D·3/D>)1;+ï

Uses CP-1252 encoding. Try it online!.

11 bytes. I know, I know, this wasn't possible when you've posted it. I simply leave this here in case someone else comes across your answer. :)

Java 8 lambda, 109 81 79 75 characters
Because... you know... even Java can be golfed...
a->{int b=(int)(.5+a*4./3),c=(int)(.5+b*2./3);return new int[]{a,b,c,++c};}

Lambda ungolfed into class:
class C {
   static int[] a(int a) {
        int b = (int) (.5 + a * 4. / 3),
            c = (int) (.5 + b * 2. / 3);
        return new int[]{a, b, c, ++c};
    }
}

I assume I'm allowed to use longs as they are also an integer type.
Sadly one needs to correctly round integers and thus a "short" cast doesn't work. By using longs we don't need to cast the rounding results back to ints.
Update
Using the nice little + 0.5 and casting afterwards trick we keep the correct rounding and save 2 chars!
Also this trick doesn't require the use of long any longer thus we can switch back to ints shaving of 4 more chars.

Welcome to PPCG!

Thanks :) I followed the questions around here for a while now and I figured that this may be a question which I could participate in though the answer is longer than I expected it to be.

I'll "+1", hoping you'll add the mandatory "because... you know... Java!"

@Frozn I'm not sure if you can remove the a->{ and the final } for -5 bytes.

@OlivierDulac Not yet :)

@OlivierDulac added in a slightly different version because I think it fits very good. If I should switch to the standard edition I can do that too.

@ΈρικΚωνσταντόπουλος I had a look at some other Java answers and they all included the 'lambda definition' thus I think I have to let it there.

Java, 64 bytes
int[]f(int i){return new int[]{i,i+=i/3+0.5,i-=i/3-0.5,i+=1.5};}

Notes

This has the required rounding build in, not sure if you can do it shorter if mixed with @user902383's solution.

Ungolfed
int[] f(int i) {
    return new int[]{
            i,
            i += i / 3 + 0.5,
            i -= i / 3 - 0.5,
            i += 1.5};
}

Output with i=9
[9, 12, 8, 9]

+1. Cuz, ya know, Java

Same as in user902383's solution, this doesn't work correctly, e.g. for 8 expected [8,11,7,8] but is [8,10,7,8], for 6 expected [6,8,5,6] but is [6,8,6,7]

@Frozn this solution is not working properly as well, and for test cases which you gave return same result as my old solution https://ideone.com/LVK8FU

Python 3, 52 bytes
f=lambda n,i=4:1//i*[n+1]or[n]+f(round(i*n/3),i%3+1)

Try it online!
Contrary to the previous Python answer, this one rounds in between cycles.
Every next value can be calculated using i*n/3, where n is the current value and i is taken from [4,2,3]. To complete the sequence, 1 is added to the result of the final iteration.

MathGolf, 14 bytes
3/+_∞3/_)Γ2∩+i

Try it online.
Explanation:
3/             # Divide the (implicit) input by 3
  +            # Add it to the (implicit) input
   _           # Duplicate this
    ∞          # Double the copy
     3/        # Divide it by 3
       _       # Duplicate this
        )      # Increase the copy by 1
         Γ     # Wrap four values into a list (since the stack only contains three, it
               # will use the implicit input as fourth):
          2∩+  # Add 1/2 to each
             i # And cast each float to an integer, removing any decimal values
               # [int(i+1/2),int(i+i/3+1/2),int((i+i/3)*2/3+1/2),int((i+i/3)*2/3+1+1/2)]
               # (after which the entire stack joined together is output implicitly)

Thunno, 18 chars
D4*3/D2*3/D1+ZMrZv

Attempt This Online!
(This is actually a bit less in bytes but the challenge asks for chars, not bytes.)
This is a full program since Thunno doesn't have functions.
Explanation
D4*3/D2*3/D1+ZMrZv  # Implicit input
D                   # Duplicate
 4*3/               # Push x*(4/3)
     D              # Duplicate
      2*3/          # Push y*(2/3)
          D         # Duplicate
           1+       # Push z+1
             ZMr    # Push the stack
                Zv  # Round each number
                    # Implicit output

Mathematica - 21 bytes
Just got Mathematica from my brothers RPi, so trying it out for fun, and what better way than a PPCG challenge.
{#,4#/3,8#/9,8#/9+1}&

Defines an anonymous function. Try it out like:
In[26]:= x:={#,4#/3,8#/9,8#/9+1}&

In[27]:= x[9]

Out[27]= {9, 12, 8, 9}

Will this give integers as a result, or fractions?

@David integers, unless the results are non-integral, in which case fractions.

Javascript, 51 bytes
I convert my java solution to JavaScript  and skimmed it down little bit.
var r=Math.round,g=a=>[a,a=r(a+a/3),a=r(a*2/3),++a]

This isn't correct. For 23 this code will output [23, 31, 20, 21] instead of [23, 31, 21, 22]

@EzioMercer fixed

Your solutions is 51 bytes, not 52 :)

@EzioMercer thanks

Actually, 21 bytes
`;;3@/+;32/*;uk1½+♂≈`

This program declares a function that performs the required operations on the top stack value.
Try it online! (the extra . at the end evaluates the function and prints the result)
Explanation:
`;;3@/+;32/*;uk1½+♂≈`
 ;;                    make two copies of x
   3@/+                divide by 3, add that to x to get y
       ;32/*           make a copy of y and multiply by 2/3 to get z
            ;u         make a copy of z and add one
              k        push stack as a list
               1½+     add 0.5 to each element
                  ♂≈   apply int() to each element (make integers from floats by flooring; this is equivalent to rounding half-up because of adding 0.5)

Python 3, 45 bytes
f=lambda i:map(round,[i,i*4/3,i*8/9,i*8/9+1])

See this code running on ideone.com

Lua, 52 Bytes
This program takes a number by command-line argument and return the corresponding array.
Programs in lua are technically functions, as the interpreter will always encapsulate them in a function. This is also this mechanic that is used when you "call" codes in other files (it basically uses loadfile/dofile).
m=math.floor x=...z=m(x*8/9)return{x,m(x*4/3),z,z+1}

Pyke, 11 bytes
D}[}3/bD)[h

Try it here!
            - implicit input()
D           - a,b = ^
 }          - b*=2
  [}3/bD)   - macro:
   }        -   tos*=2
    3/      -   tos/=3
      b     -   tos = round(tos)
       D    -   old_tos = tos = tos
            - macro
         [  - macro
          h - d +=1

Mathcad, [tbd] bytes

Mathcad codegolf byte equivalance is yet to be determined.   Taking a keyboard count as a rough equivalent, the solution is approx 40 bytes.

C++0x - 95 102 185 189 109 129 chars
int * n(int p){static int a[3];a[0]=p;a[1]=round(p+(p/3));a[2]=round((a[1]/3)*2);a[3]=a[2]+1;return a;}

This requires the cmath header to work.

Degolfed
#include <cmath>
int * ninePattern(int p) {
        static int a[3]; // pattern array
        a[0] = p; // sets first iteration
        a[1] = round(p + (p / 3)); // sets second iteration
        a[2] = round((a[1] / 3) * 2); // sets third iteration
        a[3] = a[2] + 1; // sets fourth iteration
        return a; // returns array
}

Not being a C++ expert but you could shorten it by reusing already calculated values which you have in the array. Also you might be able to remove some white space between ) and { don't know how strict C++ is.

Are those last two correct in the current version? Because I just saw you calculate p+(p/3)*(2/3) which is p+(2*p/9) instead of (p+(p/3))*(2/3)

Turns out it was an error on my part. I put - 1 instead of +1 for the last iteration :P

Arturo, 55 bytes
$[x][map@[x,y:round x+x//3y,1+dup round 2*y//3]=>floor]

Try it

JavaScript, 47 bytes
(a,r=Math.round)=>[a,a=r(a*4/3),a=r(a*2/3),++a]

Try it:

f=(a,r=Math.round)=>[a,a=r(a*4/3),a=r(a*2/3),++a]

console.log(JSON.stringify(f(9)));
console.log(JSON.stringify(f(8)));
console.log(JSON.stringify(f(6)));
console.log(JSON.stringify(f(23)));
console.log(JSON.stringify(f(159)));

Desmos, 37 bytes
a=9
b=a+\frac{a}{3}
c=\frac{2}{3}b
d=c+1

Try it online
Yay for unconventional languages!

CJam, 21 bytes
qi__3d/+mo_2d3/*i_)]`

Feedback is welcome
Explanation

qi__ - Read the input as an integer and duplicate it twice
3D/+mo - Divide one instance of the input by 3, then add it to the second instance to make y
_2d3/*i - Duplicate y, then multiply it by .6
_)]` -  Dupe, increment, wrap in array, print as array (not in code because of the ` operator :( )

Edit: Forgot to make the first three a double, so the program was broken. Fixed.

Mathematica, 51 bytes
FoldList[#2@#&,{#,Round[4#/3]&,Round[2#/3]&,#+1&}]&

Anonymous function that conforms to the current (at time of posting) version of post, which implies rounding at every step.
FoldList is a typical operation in programming. It is invoked as FoldList[f, list] and applies the two-argument function f repeatedly to the result (or the first element of the list in the first iteration), taking the next element of the list as its second argument.
Ungolfed:
#2 @ # & is an anonymous functions that applies its second argument to the first. Therefore, the list argument of FoldList consists of the successive functions to be applied to the input.
FoldList[#2 @ # &,
  {#, (* note the absence of '&' here,
         this '#' stands for the argument
         of the complete function and is
         covered by the & at the end      *)
   Round[4 # / 3] &, (* anonymous function that rounds 4/3 of its input *)
   Round[2 # / 3] &, (* ditto, 2/3 *)
   # + 1 &           (* add one function *)
  }] &               (* and the '&' makes the entire
                        thing an anonymous function,
                        whose argument is the '#' up
                        at the top.                  *)

Because input is integer and the divisions are by 3, there will never be a result like 4.5, therefore there's no need to worry about rules of rounding when the last digit is a 5: it will always be clearly closer to one integer, or another.

Dyalog APL, 33 bytes
(⌽,{1+⊃⍵})∘{⍵,⍨3÷⍨2×⊃⍵}(3÷⍨4∘×),⊢

Erlang, 80 bytes
-module(f).
-export([f/1]).
f(X)->Y=X+(X/3),Z=trunc(Y*(2/3)),[X,trunc(Y),Z,Z+1].

To run, save as f.erl, compile and call the function. It will return a list of ints:
fxk8y@fxk8y:/home/fxk8y/Dokumente/erlang/pcg# erl
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-    threads:10] [kernel-poll:false]

Eshell V7.0  (abort with ^G)
1> c(f).
{ok,f}
2> f:f(9).
"\t\f\b\t"
3>

Note that Erlang automatically converts ints to ASCII chars if you are in the ASCII value range because Erlang doesn't have a char type. Calling the function with 100 gives you the better readable [100,133,88,89].
Ungolfed:
-module(f).
-export([f/1]).

f(X) ->
  Y = X+(X/3),
  Z = trunc(Y*(2/3)),
  [X, trunc(Y), Z, Z+1].

Erlang, 46 bytes
Answer inspired by @fxk8y (I couldn't post a comment to his answer)
F=fun(X)->Z=round(X*4/9),[X,Z*3,Z*2,Z*2+1]end.

Also you can see the results with:
2> io:fwrite("~w~n", [F(9)]).
[9,12,8,9]
ok

Pyth, 20 bytes
m.RdZ[Jc*4Q3Kc*2J3hK

Explanation:
            (Implicit print)
m           For each d in array, d =
.RdZ        Round d to zero decimal places
[           The array of
  J         The result of setting J to
    c       The float division of
      *4Q   Input * 4
      3     and 3
            ,
  K         The result of setting K to
    c       The float division of
      *2J   J * 2
      3     and 3
            , and
  hK        K + 1.
            (Implicit end array)

Test here

Jolf, 17 bytes
Ώ‘Hγ+H/H3Βώ/γ3hΒ’

Defines a function Ώ. It takes input implicitly, so it also doubles as a full program. Try it here!

Jolf is becoming ESMin slowly confirmed??? :P

@Upgoat ey it's Greek. And midnight again. :P

> oh. Very sorry if I waked you up >>>>

@Upgoat not asleep yet ;)

:| idk if it's good thing I did lent wake you up or bad thing you're still awake

Axiom, 59 bytes
g(x)==round(x)::INT;f(x)==[x,a:=g(x+x/3.),b:=g(a*2./3),b+1]

test
(3) -> [[i,f(i)] for i in [9,8,6,23,159]]
   (3)
   [[9,[9,12,8,9]], [8,[8,11,7,8]], [6,[6,8,5,6]], [23,[23,31,21,22]],
    [159,[159,212,141,142]]]
                                                      Type: List List Any

PHP, 60 Bytes
print_r([$a=$argn,$b=round($a+$a/3),$c=round($b*2/3),$c+1]);

Try it online!

You can knock off a byte by doing $a*4/3.

PHP, 67 bytes
function f($x){return [$x,$y=round($x*4/3),$z=round($y*2/3),$z+1];}

Zsh*, 58 bytes
r()<<<${$(($1+.5))%.*}
r $1;r $[_+_/3];r $[2*_/3];r $[_+1]

Try it online!
(*) Using force_float and extendedglob options.


text:
Golf a golf-scorer
As a kid, I used to play the card game "golf" a lot. Your challenge, should you choose to accept it, is to calculate the score of a golf hand. Since there are over 9000 variations on this card game1, we will go with the rules I remember playing.
Rules (of the game)

You end a round with 6 cards, and you want as few points as possible.

Jokers are not used.

Aces and 2s are worth -1, and -2 points respectively.

Jacks and Kings are both worth 0 points.

Cards from 3 to 10 are worth face value. However, these are cancelled when you pair them off. For example, a 5 is worth 5 points, but two 5s are worth zero. Three 5s are worth 5 points, (since the first 2 are paired off, but the 3rd is not.) and four 5s are worth 0 (since it makes 2 pairs).

Queens are worth 15 points. Queens cannot be cancelled, e.g. 2 queens are worth 30 points.

Rules (of the challenge)
Input will be an array of integers, or 6 individual integers. Whichever one you prefer. 1 represents an ace, 2-10 represents 2-10, and Jack, Queen, and King represents 11, 12, and 13. Output is the score of the hand according to the rules above. You can safely assume that all inputs are valid, e.g. no number appears more than 4 times, and all numbers are in the range [1, 13]. Input and output can be in any reasonable format.
Test IO:
[11, 10, 3, 1, 2, 2]    --> 8
[4, 5, 5, 3, 8, 7]      --> 22
[2, 2, 2, 2, 1, 1]      --> -10 (The lowest score possible)
[12, 12, 12, 12, 10, 9] --> 79 (The highest score possible)
[9, 9, 9, 9, 11, 1]     --> -1
[8, 8, 8, 8, 11, 13]    --> 0
[10, 9, 3, 7, 12, 2]    --> 42
[1, 2, 3, 4, 5, 6]      --> 15
[10, 9, 2, 3, 4, 1]     --> 23
[10, 3, 12, 3, 7, 12]   --> 47

Shortest answer in bytes wins!

1not really, but there are a lot of variations.

Pyth, 28 27 25 bytes
s+*L%/Qd2}3Tm?<d3_d*15q12

Try it online. Test suite.
Explanation

Firstly, Pyth auto-appends some variables. The code is now s+*L%/Qd2}3Tm?<d3_d*15q12dQ.
}3T generates the list [3, 4, 5, 6, 7, 8, 9, 10].
Multiply each number in that list (*L) by the count of that number in the input (/Qd), modulo 2 (%…2). The result is 0 for paired numbers and the number itself for non-paired ones.
Map over the input numbers (m…Q):

If the number is less than 3 (?<d3), negate it (_d).
Otherwise check if it's 12 (q12d), and multiply the boolean by 15 (*15). The result is 15 for queens and 0 for anything else.

Concatenate the lists (+). The resulting list now contains the scores for the non-paired numbers (the first part) and the special cards A, 2, Q (the second part), with some extra zeroes.
Finally, take the sum of the result (s).

Alternative 25-byte solution
-+s*L%/Qd2}3T*15/Q12s<#3Q

This works similarly to the first one, but counts the queens separately and negates the aces and twos with a filter.

Python 2, 72 70 bytes
f=lambda x,*T:[x*(-1)**T.count(x),~x%2*15,-x][(x-3)/8]+(T>()and f(*T))

At one point I wished Python treated 0**0 == 0 for once so that I could do (-condition)**num. Call like f(11, 10, 3, 1, 2, 2).
Previous 72-byte version:
f=lambda x,*T:[~x%2*15,x*(-1)**(x<3or T.count(x))][x<11]+(T>()and f(*T))

><>, 63 57 56+2 = 65 59 58 bytes
The input numbers are expected to be on the stack at program start, so +2 bytes for the -v flag. Try it online!
</!?lp6$+1g6:
3\0
?\::6g2%*{+}1+:b=
;\~16g-26g2*-c6gf*+n

As all unused values in the code field are initialised to 0, it can be used to work out how many of each value is present on the stack by getting the value at [value,6], incrementing it, and putting it back in the code field. The total is then calculated as:
T = 0 + {for x in 3 to 10, x*([x,6]%2)} - [1,6] - 2*[2,6] + 15*[12,6]

Edit: golfed 6 bytes off by restructuring the input and switching the calculation steps around. Previous version:
:6g1+$6pl0=?\
/-*2g62-g610/
c ;n$\
6:b=?/>::6g2%*{+}1+!
\gf*+3/

Edit 2: saved 1 byte, thanks to Sp3000

I've seen that you've used 0=? or similar a few times - can you use ?! instead?

@Sp3000 Ack, of course, you're right. Thanks, I'll add that in

MATL, 27 26 bytes
3:10=s2\7M*G12=15*Gt3<*_vs

The input is a column array, that is, values are separated by semicolons.
Try it online! or verify all test cases (this adds a loop to take all inputs, and replaces G by 1$0G to push latest input).
Explanation
3:10=    % Take input implicitly. Compare with range [3 4 ... 10], with broadcast
s        % Sum of each column: how may threes, fours, ... tens there are
2\       % Modulo 2
7M       % Push [3 4 ... 10] again
*        % Element-wise multiply (the sum of this array is the score of 3...10)
G        % Push input again
12=      % Compare with 12, element-wise
15*      % Multiply by 15 (this is the score of 12)
G        % Push input again
t3<      % Duplicate. True for entries 1 or 2
*_       % Multiply and negate (the sum of this array is the score of 1, 2)
v        % Concatenate all stack concents into a vertical array
s        % Sum of array. Implicitly display

Pyth - 37 36 35
This is seems way too large, but FGITW.
J<#h;K-QS2++*15/K12sm*d%/Jd2{J_s@S2

Test Suite.

"This is seems way too large, but FGITW." So golf it first?

I didn't see this until I had finished my own, but they are nearly identical except using J and K seems totally unnecessary, and also you can golf +_ to - ;) I got 31: +*15/Q12-sm*d%/Qd2{>#2<#11Qs@S2

@FryAmTheEggman 24: +*15/Q12-s*R%/Qd2}3Ts@S2

JavaScript (ES6), 63 bytes
a=>a.map(e=>r+=e<3?-e:e>10?e-12?0:15:(m[e]^=1)?e:-e,r=0,m=[])|r

Or if you prefer,
a=>a.map(e=>r-=e<3?e:e>10?e-12?0:-15:(m[e]^=1)?-e:e,r=0,m=[])|r

Perl 5.10.0 + -n, 115 64 60 56 bytes
$p+=$_-12?$_>2?$_<11?++$l[$_]%2?$_:-$_:0:-$_:15}{say$p

Try it online!
Explanation:
Adding the -n loop around it:
# Used variables:
# $_: input (auto)
# $p: points
# $l[n]: number of occurences of n (for 3-10)
while (<>) { # for every input
    $p += $_ - 12 ? # if the input is not 12 (queen) ...
        $_ > 2 ? # then: if it's > 2 (not ace or 2) ...
            $_ < 11 ? # then: if < 11 (3-10) ...
                ++$l[$_] % 2 ? # then: if it's an odd occurence (1st, 3rd, 5th, ...)
                    $_ # add it
                    : -$_ # else subtract it
            : 0 # no points for other stuff (J, K)
        : -$_ # negative points for ace and 2
    : 15 # 15 points for queen
}
{ # after input:
    say $p # output points
}

Perl 5, 74 +1 (-a) = 75 bytes
map$s+=/12/?15:$_<3?-$_:$_<11?$k{$_}?-delete$k{$_}:($k{$_}=$_):0,@F;say $s

Try it online!

Command line flags are free now!


text:
Deep learning Fizzbuzz
Inspired by the job-interview with Joel Grus, the goal of this challenge is to write a tensorflow (or other deep/machine learning) program that learns Fizzbuzz and correctly prints out the answers to the positive integers less than 1000.
You can assume there are files named train.csv and test.csv and each contain a sorted list of sequential integers and the fizzbuzz answer:
 ...
 100, buzz
 101, 101
 102, fizz
 103, 103
 104, 104
 105, buzz
 ...
 150000, fizzbuzz

test.csv spans 1-1000 and train.csv spans 1001-150000.
Rules

You must not hard-code the rules to Fizzbuzz anywhere in your program. The output must be from a machine learned representation that is learned while running the code.
You must utilize train.csv in the training set and check your output against test.csv. You cannot use test.csv during training.
You must get all outputs correct from test.csv (but as is case with deep-learning, we'll allow your code to fail this rule no more than 5% of the time).
You may use any language and any external module (eg. python/tensorflow) as long they explicitly perform some kind of learning. Reference both the language and the module in the title of your post.
This is a popularity contest, so the submission with the most votes after one week wins.

Hi Hooked, welcome to the site! I'd encourage you to try using the sandbox before posting a challenge next time, since you probably would have been advised to avoid a popularity contest. Right now, we're in an awkward stage where popularity contests are still technically allowed, but frowned upon, and hard to do right (especially for new users). One thing that might attract downvotes on this question is that it's asking to solve a task in a very specific way, which is cautioned against in the tag wiki.

Thanks for the info @DrGreenEggsandHamDJ. I'm a long time lurker and I tried to model this off of previous questions (without knowledge of the transition). Re restrictions: there are many creative ways to solve this problem (the type of NN isn't enforced). If it gets downvoted I'll understand and pack this one up, but I'm really looking forward to see what comes out of this! (I don't think there are any deep learning codegolf.SE questions at all)

Not all machine learning algorithms are "Deep Learning", so I don't really see what it has to do with the challenge.

Where can we find train.csv and test.csv? What is the validity criterion?

What's the representation of the input and nonlinear functions that are allowed? There are trivial answers if you don't constraint these...

Here's an example of a good machine learning question: http://codegolf.stackexchange.com/questions/44707/lab-rat-race-an-exercise-in-genetic-algorithms