text:
Generate regular expressions for matching natural numbers between `m` and `n`
The type of regular expression is PCRE.
Write a program that output a valid PCRE such that it matches all natural numbers between m and n and does not match anything else. No leading zeros are allowed.
For example, let m and n be 123 and 4321, then the program might output
1(2[3-9]|[3-9]\d)|[2-9]\d\d|[123]\d\d\d|4([012]\d\d|3([01]\d|2[01])).
This matches the exact string, so ^ and $ anchors are implicit.
One should try to balance the two:

The regular expression should have a reasonable size.
The code should be short.

Let's optimize for
code length in characters + 2*regular expression length for input 123456 and 7654321
Side Note: It be interesting if we can prove the shortest PCRE regular expression is of the size O(log n log log n) or something.

Can you define the winning criteria? Maybe something like re_size*5 + prog_size (smaller = better), where re_size is the maximum for m and n up to 5 digits. There are many other ways to do it - what matters is that we can grade the answers.

"Write a program that output a valid PCRE such that it matches all natural numbers between m and n" Presumably "and fails to match all other inputs", no? Lest some smart arse offers print .* in some language.

Would've been more fun with negative numbers :-D

if(min == 123456 && max == 7654321){print_hardcoded_regex}else{enumerate_range_and_join}

Perl, score 455
191 chars, 132 regex length
sub b{my$a=shift;$_=(@_>0&&$a.b(@_).($a-->0&&'|')).($a>=0&&($a>1
?"[0-$a]":$a));/\|/?"($_)":$_}sub a{b(@a=split//,<>-1+$x++).(@a>
1&&"|.{1,$#a}")}print'(?!0|('.a.')$)(?=('.a.'$))^\d{1,'.@a.'}$'

Input: 123456, 7654321
(?!0|((1(2(3(4(5[0-5]|[0-4])|[0-3])|[0-2])|1)|0)|.{1,5})$)(?=((7(6(5(4(3(21|1)|[0-2])|[0-3])|[0-4])|[0-5])|[0-6])|.{1,6}$))^\d{1,7}$

Update: I was able to further simplify this when I realized that most of the patterns ended with things like \d{3}.  These were doing nothing more than enforcing a string length--and doing so very repetitively, since they occurred on every term.  I eliminated this by using another lookahead to enforce the "less than" condition, only checking that either: 1) the first part of the number does not exceed the input or 2) the number is fewer digits than the input.  Then the main regex just verifies that it is not too many digits.
I also incorporated Peter Taylor's idea of negative look-ahead for checking the "greater than" condition.
The key to simplifying this problem (at least for me) was to break the regex in two: a look-ahead makes sure the number is not less than the minimum, then the main part of the regex checks that it is not greater than the maximum.  It is a little bit silly for small input, but it is not so bad for large input.
Note: the 0| at the beginning is to exclude anything that starts with a zero from matching.  This is required because of the recursive nature of the regex function: inner parts of the match can start with zero, but the entire number cannot.  The regex function can't tell the difference, so I excluded any number starting with zero as a special case.
Input: 1, 4
(?!0|(0)$)(?=([0-4]$))^\d{1,1}$

Unreasonably Long Regex Version, 29 chars:
print'^',join('|',<>..<>),'$'

Don't forget that there's a special special case, which is that if m is 0 then you need to allow 0 despite it having a leading zero.

@PeterTaylor, I thought "natural numbers" meant positive integers.  Checking wikipedia, I see that there is actually no agreement on whether zero is a natural number.  At this point, I choose to take refuge in the ambiguity rather than change my solution :)

Javascript, score 118740839
function makere(m,n){r='(';for(i=m;i<n;)r+=i+++'|';return (r+i)+')';}

I suppose whether or not you like this depends on how you define 'a reasonable size.' :-)

Not gonna test this. I believe you.

GolfScript (126 + 2*170 = 466)
~)]{`:&,:_,{:i'('\_(<:/i&=48-:D 2<{D^i!!D*|1,*}{'['\i>2D<'-'*D(']?'3$)<}if/D!!*{'\d{'/i>'1,'*_(i-'}|'D}*}%_')'*]}%'(?!'\~'$)'\

For the given values it gives
(?!(\d{1,5}|1([01]\d{4}|2([0-2]\d{3}|3([0-3]\d{2}|4([0-4]\d{1}|5([0-5]))))))$)([1-6]?\d{1,6}|7([0-5]\d{5}|6([0-4]\d{4}|5([0-3]\d{3}|4([0-2]\d{2}|3([01]\d{1}|2([01])))))))

Dissection to follow, but the basic idea is to define a block of code which maps a single natural number to a regex matching any smaller natural number, and then turn the inputs lb and ub into a negative lookahead for (natural number smaller than lb) combined with the regex for (natural number smaller than ub+1).
The logic is quite complicated, so even by GolfScript standards it's cryptic. Until I get round to writing a detailed dissection, here's a list of variables:
&  the whole number string
i  the current idx
D  the current digit
/  not-the-last-digit
_  total number of digits

@dan1111, I looked at the documentation for PCRE but I didn't see anything forbidding out-of-order character classes, and the tester I used didn't give an error. I'll have to look into that. OTOH if your regex engine doesn't like an expression ending in | then that's a bug in your regex engine, not in my regex.

sorry, I didn't realize that (a|) is actually valid.  However, [1-0] in your previous regex did not work in Perl or an online tester I tried.

@dan1111, after you pointed it out I realised that the online tester I was using was swallowing the error. I reproduced it on a machine with Perl, and wrote a test framework using Perl to check the regexes. Thanks for pointing it out.

Haskell 2063+2*151=2365
It's guaranteed the generated regex has length O(log n log log n).
matchIntRange 12345 7654321
1(2(3(4(5[6-9]|[6-9]\d)|[5-9]\d\d)|[4-9]\d{3})|[3-9]\d{4})|[2-9]\d{5}|[1-6]\d{6}|7([0-5]\d{5}|6([0-4]\d{4}|5([0-3]\d{3}|4([012]\d\d|3([01]\d|2[01])))))
import Data.Digits

data RegEx = Range Int Int | MatchNone | All Int
            | Or RegEx RegEx | Concat [RegEx]

alphabet = "\\d"

instance Show RegEx where
  show (Range i j)
   | i == j    = show i
   | i+1 == j  = concat ["[",show i,show j,"]"]
   | i+2 == j  = concat ["[",show i,show (i+1), show (i+2),"]"]
   | otherwise = concat ["[",show i,"-",show j,"]"]
  show (Or a b)  = show a ++ "|" ++ show b
  show MatchNone = "^$"
  show (All n)
   | n < 3     = concat $ replicate n alphabet
   | otherwise = concat [alphabet,"{",show n,"}"]
  show e@(Concat xs)
   | atomic e  = concatMap show xs
   | otherwise = concatMap show' xs
   where show' (Or a b) = "("++show (Or a b)++")"
         show' x = show x
         atomic (Concat xs) = all atomic xs
         atomic (Or _ _)    = False
         atomic _           = True

-- Match integers in a certain range
matchIntRange :: Int->Int->RegEx
matchIntRange a b
 | 0 > min a b = error "Negative input"
 | a > b       = MatchNone
 | otherwise = build (d a) (d b)
 where build :: [Int]->[Int]->RegEx
       build [] [] = Concat []
       build (a@(x:xs)) (b@(y:ys))
         | sl && x == y       = Concat [Range x x, build xs ys]
         | sl && all9 && all0 = Concat [Range x y, All n]
         | sl && all0         = Or (Concat [Range x (y-1), All n]) upper
         | sl && all9         = Or lower (Concat [Range (x+1) y, All n])
         | sl && x+1 <= y-1   = Or (Or lower middle) upper
         | sl                 = Or lower upper
         | otherwise          = Or (build a (nines la)) (build (1:zeros la) b)
         where (la,lb) = (length a, length b)
               sl      = la == lb
               n       = length xs
               upper   = Concat [Range y y, build (zeros n) ys]
               lower   = Concat [Range x x, build xs (nines n)]
               middle  = Concat [Range (x+1) (y-1), All n]
               all9    = all (==9) ys
               all0    = all (==0) xs
       zeros n   = replicate n 0
       nines n   = replicate n 9
       d 0 = [0]
       d n = digits 10 n

The code below is a simple version that helps with understanding the algorithm, but it doesn't do any optimization to improve the regex size.
matchIntRange 123 4321
(((1((2((3|[4-8])|9)|[3-8]((0|[1-8])|9))|9((0|[1-8])|9))|[2-8]((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|9((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|((1((0((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9))|[1-8]((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|9((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|[2-3]((0((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9))|[1-8]((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|9((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9))))|4((0((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9))|[1-2]((0((0|[1-8])|9)|[1-8]((0|[1-8])|9))|9((0|[1-8])|9)))|3((0((0|[1-8])|9)|1((0|[1-8])|9))|2(0|1)))))

The regular expression has 680 characters.
Here is the code
import Data.Digits

data RegEx = Range Int Int | MatchNone | Or RegEx RegEx | Concat [RegEx]

alphabet = "\\d"

instance Show RegEx where
  show (Range i j)
   | i == j    = show i
   | otherwise = concat ["[",show i,"-",show j,"]"]
  show (Or a b)  = concat ["(",show a,"|",show b,")"]
  show MatchNone = "^$"
  show (Concat xs) = concatMap show xs

matchIntRange :: Int->Int->RegEx
matchIntRange a b
 | 0 > min a b = error "Negative input"
 | a > b       = MatchNone
 | otherwise = build (d a) (d b)
 where build :: [Int]->[Int]->RegEx
       build [] [] = Concat []
       build (a@(x:xs)) (b@(y:ys))
         | sl && x == y     = Concat [Range x x, build xs ys]
         | sl && x+1 <= y-1 = Or (Or lower middle) upper
         | sl               = Or lower upper
         | otherwise        = Or (build a (nines la)) (build (1:zeros la) b)
         where (la,lb) = (length a, length b)
               sl      = la == lb
               n       = length xs
               upper   = Concat [Range y y, build (zeros n) ys]
               lower   = Concat [Range x x, build xs (nines n)]
               middle  = Concat [Range (x+1) (y-1), build (zeros n) (nines n)]
       zeros n = replicate n 0
       nines n = replicate n 9
       d 0 = [0]
       d n = digits 10 n


text:
Generate ordered combinations with repetition
Given a string of different characters, and a number n, generate all the ordered combinations with repetition, of length 1 to n, using those characters.
Another way to define it is to see the given characters as "custom" digits in the base (radix) of the number of characters, then the program should generate all the "numbers" with 1 to n digits in that base, however, leading "zeros" are included too.
The combinations should be ordered by their length (1 character first, then 2, etc), but other than that they can be in any order. You can choose the most convenient ways of handling input and output. Shortest code wins.
Examples:
ab, 3 -> a,b,aa,ab,ba,bb,aaa,aab,aba,baa,abb,bab,bba,bbb
0123456789, 2 -> 0,1,2,3,4,5,6,7,8,9,00,01,...,09,10,11,...,99

Seriously? "Count"?

@PeterTaylor what do you mean?

You recognise in thep problem that you're simply asking people to count. Do you not think that's a bit unambitious?

@PeterTaylor Well it's not straightforward counting, even when using base 10 digits. I'd like to see how to do it in the shortest code. It's not intended to be difficult. I've seen more trivial questions too and don't think that should be a problem.

Furthermore, there are at least a couple of problems where I can apply this :)

APL (Dyalog Unicode), 13 bytesSBCS
⊃,/,¨∘.,\⎕⍴⊂⍞

Try it online!
never miss an opportunity to use a scan :)
prompts for a string of "digits" and then for n
thanks @Adám for telling me how to enable ]box on TIO

Python 2, 56 bytes
n is the maximum length and s is expected to be a list of characters. It is not clear to me whether n = 0 or an empty character list are valid inputs, but this function also handles them correctly.
f=lambda s,n:n*s and s+[x+c for x in f(s,n-1)for c in s]

J, 41 char
   f=.}:@;@({@(,&(<',')@(]#<@[))"1 0>:@i.@])

   'ab' f 3
a,b,aa,ab,ba,bb,aaa,aab,aba,abb,baa,bab,bba,bbb

APL (31)
{,/⍺∘{↓⍉⍺[1+(⍵⍴⍴⍺)⊤⍳⍵*⍨⍴⍺]}¨⍳⍵}

Usage: the left argument is the string and the right argument is the number, like so:
    'ab'{,/⍺∘{↓⍉⍺[1+(⍵⍴⍴⍺)⊤⍳⍵*⍨⍴⍺]}¨⍳⍵}3
b  a  ab  ba  bb  aa  aab  aba  abb  baa  bab  bba  bbb  aaa

The output is ordered by length, but within the length groups they are shifted one to the left, this was easiest.
Explanation:

,/⍺∘{...}¨⍳⍵: for 1..⍵, apply the function to ⍺ and join the results together.
(⍵⍴⍴⍺)⊤⍳⍵*⍨⍴⍺: for each number from 1 to (⍵=(current length))^(⍴⍺=(amount of chars)), convert to base ⍴⍺ using ⍵ digits.
1+: add one because arrays are 1-indexed.
⍺[...]: use these as indexes into the string
↓⍉: rotate the matrix, so the 'numbers' are on the rows instead of in the columns, and then split the matrix up by rows.

Does APL have a single-byte encoding for its symbols?

@aditsu: Dyalog APL uses Unicode, I'd guess all other modern APLs do the same. However, before there was Unicode you'd use a codepage so it is possible.

I'm mainly asking because I'm concerned about no. of bytes vs no. of characters. I don't know how many different symbols APL uses.

Unless I've forgotten some or miscounted, Dyalog APL has 74 function and operator characters, which would fit into a byte together with 7-bit ASCII just fine. And there is also some overlap between those and normal characters like ?!/\-+*~&=,.| and probably some more. There exist single-byte APL encodings but Unicode is easier to use.

Haskell, 34 characters
x%n=do k<-[1..n];mapM(\_->x)[1..k]

Straightforward use of the list monad. The only real golfing is the use of mapM instead of the more idiomatic (and shorter) replicateM which would require importing Control.Monad.
Usage
> "ab" % 3
["a","b","aa","ab","ba","bb","aaa","aab","aba","abb","baa","bab","bba","bbb"]

Python, 97 94
from itertools import*
s,n=input()
L=t=[]
exec"t=t+[s];L+=map(''.join,product(*t));"*n
print L

t=t+[s] can't be shortened to t+=[s] because L and t would be pointing to the same list.
Input: 'ab', 3
Output:
['a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bb
a', 'bbb']

Mathematica 29 19 28
Join@@(i~Tuples~#&/@Range@n)

Usage
i={a, 4, 3.2};n=3;

Join@@(i~Tuples~#&/@Range@n)

{{a}, {4}, {3.2}, {a, a}, {a, 4}, {a, 3.2}, {4, a}, {4, 4}, {4,
    3.2}, {3.2, a}, {3.2, 4}, {3.2, 3.2}, {a, a, a}, {a, a, 4}, {a, a,
    3.2}, {a, 4, a}, {a, 4, 4}, {a, 4, 3.2}, {a, 3.2, a}, {a, 3.2,
    4}, {a, 3.2, 3.2}, {4, a, a}, {4, a, 4}, {4, a, 3.2}, {4, 4, a}, {4,
     4, 4}, {4, 4, 3.2}, {4, 3.2, a}, {4, 3.2, 4}, {4, 3.2, 3.2}, {3.2,
    a, a}, {3.2, a, 4}, {3.2, a, 3.2}, {3.2, 4, a}, {3.2, 4, 4}, {3.2,
    4, 3.2}, {3.2, 3.2, a}, {3.2, 3.2, 4}, {3.2, 3.2, 3.2}}

Is it possible to run this without buying Mathematica? Also, could you "flatten" the output so it's not grouped by length?

You need to purchase Mathematica.  (In principle, the code can be tested on WolframAlpha.com, but for some reason the linking does not work properly.)

Purchase Mathematica? Sorry, not gonna happen :p
The code doesn't work unmodified on wolframalpha, but I could see some output from one of your earlier links, so anyway I'm tentatively accepting it as the shortest answer.

MATL, 9 8 bytes
x:"1G@Z^

Try it on MATL Online!
(MATL was created after this challenge was posted, but I believe that's ok by meta consensus these days.)
(-1 bytes thanks to @Luis Mendo.)
x -  delete string input from stack (automatically copies it to clipboard G)
:" - implicit input of number n, loop from 1 to n
1G  - paste back the input string from clipboard G on the stack
@  - push the current loop iteration index
Z^ - cartesian power: cartesian product of input with itself @ number of times
The cartesian power results (@-digit "numbers" in the given base) are accumulated on the stack and implicitly displayed at the end.

You can  save 1 byte with x:"1G@Z^

@LuisMendo Updated (finally!). Thanks.

Python - 106
The straightforward, uncreative solution. If you find significant improvements, please post as a separate answer.
s,n=input()
l=len(s)
for i in range(1,n+1):
 for j in range(l**i):t='';x=j;exec't+=s[x%l];x/=l;'*i;print t

Input: "ab",3
Output:
a
b
aa
ba
ab
bb
aaa
baa
aba
bba
aab
bab
abb
bbb

Python, 100
Derived from @aditsu's solution.
s,n=input()
L=len(s)
i=0
while i<n:i+=1;j=0;exec"x=j=j+1;t='';exec't+=s[x%L];x/=L;'*i;print t;"*L**i

Input: 'ab', 3
Output:
b
a
ba
ab
bb
aa
baa
aba
bba
aab
bab
abb
bbb
aaa

Perl 5 + -nlF -M5.010 -MList::Util+(uniq), 41 bytes
$,=$"=",";say grep/./,uniq glob"{,@F}"x<>

Try it online!
-1 byte thanks to @Xcali!

You can save a byte by using commas between output items: Try it online!

@Xcali Ah good spot, thank you!

Pyth, 6 bytes
s^LQSE

Expects the set of characters as 1st input, number of digits as 2nd. A byte could be saved if there were a single-byte method to repeatedly access the 2nd input, but alas...
Try it online here.
s^LQSE   Implicit: Q=input 1, E=evaluate next input
    SE   Range [1,2,...,E]
 ^LQ     Perform repeated cartesian product of Q for each element of the above
s        Flatten

Perl 6, 33 bytes
{flat [\X~] '',|[$^a.comb xx$^b]}

Try it online!
Anonymous code block that takes a string and a number and returns a list of strings.

PHP 180
I have no idea... I'm feeling lazy.
<?php $f=fgetcsv(STDIN);$l=strlen($f[1]);$s=str_split($f[1]);for($i=1;$i<=$f[0];$i++)for($j=0;$j<pow($l,$i);$j++){$o="";$x=$j;for($q=0;$q<$i;$q++){$o.=$s[$x%$l];$x/=$l;}echo"$o ";}

Erlang 110
The Y combinator version (for shell):
fun(X, N)->F=fun(_,_,0)->[[]];(G, X, Y)->[[A|B]||A<-X,B<-G(G,X,Y-1)]end,[V||Y<-lists:seq(1,N),V<-F(F,X,Y)]end.

Erlang 89 (118)
Module version:
-module(g).
-export([g/2]).
h(_,0)->[[]];h(X,N)->[[A|B]||A<-X,B<-h(X,N-1)].
g(X,N)->[V||Y<-lists:seq(1,N),V<-h(X,Y)].

Chars counted without mandatory bookkeeping (module and export).

Ruby, 73 64 bytes
->s,n{c=s.chars;(0...n).flat_map{c.product(*[c]*_1)}.map{_1*''}}

66 byte version because TIO doesn't support _1
->s,n{c=s.chars;(0...n).flat_map{|i|c.product(*[c]*i)}.map &:join}

Try it online!

K (ngn/k), 17 bytes
{,/(,/,'/:)\x#,y}

Try it online!

Japt, 9 bytes
Explanations to follow.
õ!àUçV)mâ

Try it
õ_çV àZ â

Try it

Jelly, 6 bytes
WẋŒpƤẎ

Try it online!
Function submission, taking the list of digits as the first argument and the number of digits as the second. The digits themselves can be any of Jelly's data types, but I used integers in the TIO link above because it produces the best-looking output in Jelly's automatic “function → full program” wrapper.
Explanation
WẋŒpƤẎ                      (called with arguments, e.g. [1,2,5], 3)
Wẋ       Make {argument 2} copies of {argument 1}  (e.g. [[1,2,5],[1,2,5],[1,2,5])
    Ƥ    For each prefix:                          (e.g. 1-3 copies of [1,2,5])
  Œp       take Cartesian product of its elements
     Ẏ   Flatten one level

The Cartesian product effectively gives us all numbers with a given number of digits (according to which prefix we're working with). So we end up with a list of lists of combinations (grouped by length), and can flatten that one level in order to get a list that isn't grouped (but which is still sorted by length, as the question requires, as Ẏ doesn't change the relative order of the elements and Ƥ tries shorter prefixes first).

05AB1E, 6 bytes
ã€Œ˜Ùé

Try it online or verify all test cases.
Explanation:
ã         # Cartesian product of the second input repeated the first input amount of times
          #  i.e. 3 and 'ab' → ['aaa','aab','aba','abb','baa','bab','bba','bbb']
 €Œ       # Take all the substrings for each of those results
          #  i.e. 'aba' → ['a','ab','aba','b','ba','a']
   ˜      # Flatten the list of lists
    Ù     # Remove all duplicated values
     é    # Sort the list by length

6-bytes alternative:
NOTE: Flexible output: Outputs a new list for every length, all on the same print-line.
Converting it to a single list would be 2 bytes longer: Lv²yã`}) (Try it online).
Lv²yã?

Try it online or verify all test cases.
Explanation:
Lv        # Loop `y` in the range [1, integer_input]
  ²yã     #  Take the second input and create an `y` times repeated cartesian product of it
          #   i.e. y=2 and 'ab' → ['aa','ab','ba','bb']
     ?    #  Print this list (without new-line)

source: Stack Exchange

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

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

sort: votes


text:
Neustadtl score
Write the shortest function that takes a two-dimensional square array representing the scores of a chess round, and outputs an array of the Neustadtl scores of the players.
The two-dimensional array is structured so that array[i][j] is the score earned by the player i against player j.
The Neustadtl score is used to tie-break in chess tournaments when their conventional scores tie. The Neustadtl score is calculated by adding the scores of the player defeated and half of the scores the player drew with.
Here is an example data for a 5 on 5 match.
               cs  ns
1. X 1 ½ 1 0 | 2½  4.25
2. 0 X 1 ½ 0 | 1½  2.5
3. ½ 0 X ½ ½ | 1½  3.5
4. 0 ½ ½ X 1 | 2   4
5. 1 1 ½ 0 X | 2½  4.75

where cs stands for conventional score and ns stands for Neustadtl score.
For example, the Neustadtl score of the 4th player is:
  0(player 1's cs) + ½(player 2's cs) + ½(player 3's cs) + 1(player 5's cs)
= 0(2½) + ½(1½) + ½(1½) + 1(2½)
= 4

For more details and another example data, see its Wikipedia article.
Some notes:

Assume the diagonal is always zero (array[j, j] = 0)
No need to check if the array is square
No need to check if the data makes sense (a valid scoretable has the property array[i, j] + array[j, i] = 1, i != j)

Mathematica  11 10 8
#.Tr/@#&

(Thanks @chyanog!)
Usage
m = {{0,  1, .5, 1, 0}, {0, 0, 1, .5, 0}, {.5, 0, 0, .5, .5},
     {0, .5, .5, 0, 1}, {1, 1, .5, 0, 0}}

#.Tr/@#&[m]

Result
    {4.25, 2.5, 3.5, 4., 4.75}
Edit
Some explanations:

Tr is "Trace". When applied to a one-dimensional list returns the elements sum
/@ is "Map". Feeds the preceding operator with one element at a time and returns a list
. is "dot product". Multiplies vectors (or matrices and vectors)
  the set # ... & is a functional construct. The &feeds the #with its arguments

How about Tr?

@chyanog Hey! Yesss

APL 31 29 24 or 10 or 7
If you will accept decimal input and output then the following takes your score array as screen input via ←⊃⎕ with each row of the array enclosed in parentheses.
((m,'|'),+/m),m+.×+/m←⊃⎕

Your example would look as follows:
Input:

(0 1 0.5 1 0)(0 0 1 0.5 0)(0.5 0 0 0.5 0.5)(0 0.5 0.5 0 1)(1 1 0.5 0 0)

Output:

0.0 1.0 0.5 1.0 0.0 | 2.5 4.25
0.0 0.0 1.0 0.5 0.0 | 1.5 2.50
0.5 0.0 0.0 0.5 0.5 | 1.5 3.50
0.0 0.5 0.5 0.0 1.0 | 2.0 4.00
1.0 1.0 0.5 0.0 0.0 | 2.5 4.75

with the input displayed along with the separator and the two scores as the output. Or if you just want the Neustadtl score then:
m+.×+/m←⊃⎕

If the input scores array exists as a global m then:
m←⊃(0 1 0.5 1 0)(0 0 1 0.5 0)(0.5 0 0 0.5 0.5)(0 0.5 0.5 0 1)(1 1 0.5 0 0)

m+.×+/m

4.25 2.5 3.5 4 4.75

Latest mods prompted by marinus. Thanks.

What APL are you using? Doesn't ⍞ only read one line? How can ⍎⍞ get you a matrix? Also, isn't ⍎⍞ the same as ⎕?

@marinus APL+WIN v5. Yes or a variable. By entering your matrix as, for example, 2 2⍴⍳4. Yes you are right. Another senior moment!!!

@marinus Another useful alternative for matrix entry is to use ⊃⎕ and enter each row enclosed in parentheses. In this case: (0 1 0.5 1 0)(0 0 1 0.5 0)(0.5 0 0 0.5 0.5)(0 0.5 0.5 0 1)(1 1 0.5 0 0)

K,13
{+/'x*\:+/'x}

.
k)input:(0 1 0.5 1 0;0 0 1 0.5 0;0.5 0 0 0.5 0.5;0 0.5 0.5 0 1;1 1 0.5 0 0)
k)input
0   1   0.5 1   0
0   0   1   0.5 0
0.5 0   0   0.5 0.5
0   0.5 0.5 0   1
1   1   0.5 0   0
k){+/'x*\:+/'x}[input]
4.25 2.5 3.5 4 4.75

It's unclear whether you just want a 1-d array of Neustadtl scores or if you want the output that's in your example. If it's the latter then:
K, 23
{x!,:'b,'+/'x*\:b:+/'x}

.
k){x!,:'b,'+/'x*\:b:+/'x}[input]
0   1   0.5 1   0  | 2.5 4.25
0   0   1   0.5 0  | 1.5 2.5
0.5 0   0   0.5 0.5| 1.5 3.5
0   0.5 0.5 0   1  | 2 4
1   1   0.5 0   0  | 2.5 4.75

R - 25
function(x)x%*%rowSums(x)

R> input <- matrix(c(0,  1, .5,  1,  0,
                     0,  0,  1, .5,  0,
                    .5,  0,  0, .5, .5,
                     0, .5, .5,  0,  1,
                     1,  1, .5,  0,  0), nrow=5, byrow=TRUE)

R> (function(x)x%*%rowSums(x))(input)
     [,1]
[1,] 4.25
[2,] 2.50
[3,] 3.50
[4,] 4.00
[5,] 4.75

C# 106 (88 function body + 18 required using stetement)
float[]N(float[][]s){return s.Select(l=>l.Select((v,i)=>v*s[i].Sum()).Sum()).ToArray();}

This function requires the using System.Linq; directive to be present in the file, so I added that to the character count as well.
IdeOne link: http://ideone.com/cPcfwg
OK, I know it's not very short, but I love C# and LINQ so much that I just had to do it. :)
Here's a more readable version of the code:
public float[] Neustadl(float[][] scoreTable)
{
    return scoreTable.Select(scoreLine =>
                        scoreLine.Select((lineValue, otherPlayerIndex) =>
                            lineValue * scoreTable[otherPlayerIndex].Sum())
                        .Sum()
                    ).ToArray();
}

Ruby, 62
N=->a{a.map{|l|z=0
l.zip(a.map{|l|eval l*?+}){|k,s|z+=k*s}
z}}

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


text:
Implement DFA/NFA/epsilon-NFA
Write the shortest code that implements a:

DFA
NFA
epsilon-NFA

The program should accept as input:

a string(that we want to see if is accepted or not)
the delta function, represented in whichever way it's more convenient.
the "set" of final states of the automaton

And it should output Accepted! if the string is accepted by the automaton, and the string Not a chance! otherwise.
Note that all inputs should be taken from stdin or the command line.
The total points should be computed as (L1 + 2*L2 + 3*L3) / 6 where Li is the length, in bytes, of the code solving point i and the winner will be the answer with smallest score.

Edit: You can assume the starting state, so that it is not required as input.
The epsilon transitions can be labelled in any way you want.

Edit2: An example of input for the DFA:
0100
{'q_0': {'0': 'q_1', '1': 'q_0'}, 'q_1': {'0': 'q_2', '1': 'q_3'}, 'q_2': {'0': 'q_2', '1': 'q_3'}, 'q_3': {'1': 'q_0', '0': 'q_1'}}
{'q_2', 'q_3'}

Output:
Accepted!

An other input:
010010
{'q_0': {'0': 'q_1', '1': 'q_0'}, 'q_1': {'0': 'q_2', '1': 'q_3'}, 'q_2': {'0': 'q_2', '1': 'q_3'}, 'q_3': {'1': 'q_0', '0': 'q_1'}}
{'q_2', 'q_3'}

Output:
Not a chance!

I want to stress that you are free to use a different formatting for the inputs. Choose the simpler to "parse" in your target language. The above is simple to use in python since you can eval it to obtain the real objects.

How do we choose between 1, 2, and 3?

...or do we write 3 separate programs?

@KeithRandall the scoring indicates three programs are desired.

Exactly, you have to produce three different programs, one for the DFA, one for the NFA and one for the epsilon-NFA. I chose to do so since they are stricly related(hence it doesn't make sense to ask 3 different questions).

Can we get some example inputs / outputs?

@boothby I'll now add an example, but keep in mind that you are free to change the formatting of the input if a different formatting is more convenient. The example I'll write is probably a convenient way for the python solution.

Python, score = 138 1/6 = (79+108*2+178*3)/6
DFA
S,D,F=input()
s=1
for c in S:s=D[s,c]
print["Not a chance!","Accepted!"][F&s>0]

Input is a triple of string S, a delta function D, and final state mask F.  I number each state with a power of 2, so F is just the OR of each accepting state.  D is a map from (state,input char)->state.
example input (accepts all strings ending in b):
'abab',{(1,'a'):1,(1,'b'):2,(2,'a'):1,(2,'b'):2},2

NFA
S,D,F=input()
s=1
for c in S:
 t,s=s,0
 for a,b in D[c]:s|=t/a%2*b
print["Not a chance!","Accepted!"][F&s>0]

We number states as powers of 2 as before.  D is a map from input character to a list of transitions labeled by that character.
example input (accepts all strings ending in b):
'abab',{'a':[(1,1)],'b':[(1,1),(1,2)]},2

epsilon-NFA
S,D,F=input()
E={1:1}
for i in D[0]:
 for a,b in D[0]:E[a]=a|E.get(b,b)
s=E[1]
for c in S:
 t,s=s,0
 for a,b in D[c]:s|=t/a%2*E.get(b,b)
print["Not a chance!","Accepted!"][F&s>0]

Same as NFA, but with the additional 0 character listing the epsilon transitions.
example input (accepts all strings ending in b):
'abab',{'a':[(1,1)],'b':[(1,1),(1,2)],0:[(2,4)]},2

i think you win


text:
Triangle Area Side Side Side
Given three sides of a triangle, print area of this triangle.
Test cases:
In: 2,3,4
Out: 2.90473750965556
In: 3,4,5
Out: 6
Given the sides \$a\$, \$b\$, and \$c\$, you can assume that \$a>0\$, \$b>0\$, \$c>0\$, \$a+b>c\$, \$b+c>a\$, and \$c+a>b\$.
This is code-golf, shortest answer per language in bytes wins.

What is the required precision? Can the input and outputs be integers? Rounded to the nearest hundredth? Single precision floats? Rationals?

J, 23 19 chars
   (4%~2%:[:*/+/-0,+:)

   (4%~2%:[:*/+/-0,+:) 2 3 4
2.90474

   (4%~2%:[:*/+/-0,+:) 3,4,5
6

17-char version if input is in i: 4%~%:*/(+/,+/-+:)i
original 23-char version: (%:@(+/**/@(+/-+:))%4:)

APL 21 20
Takes screen input via ←⎕
(×/(+/t÷2)-0,t←⎕)*.5

Mathematica 23
√Times@@(+##/2-{0,##})&

Just an aside comment. We (usually) try to provide Mma code as functions here. For example in your case Sqrt[Tr@#*Times@@(Tr@#-2#)]/4&

28 chars, as a function (Tr@#Times@@(Tr@#-2#))^.5/4&, or 27 using a variable

@belisarius Thanks for your suggestion.

Python 2, 53
t=input()
s=a=sum(t)/2.
for x in t:a*=s-x
print a**.5

Input: 2,3,4
Output: 2.90473750966

I wasted a lot of time trying to come up with a better solution. I'm convinced this is as good as it gets

@jamylak you and me both ;)

Python 57 bytes
a,b,c=input()
s=(a+b+c)*.5
print(s*(s-a)*(s-b)*(s-c))**.5

Using Heron's Formula.
Sample usage:
$ echo 2,3,4 | python triangle-area.py
2.90473750966

$ echo 3,4,5 | python triangle-area.py
6.0

A 58 byte variant:
a,b,c=input()
print((a+b+c)*(b+c-a)*(a+c-b)*(a+b-c))**.5/4

I'm not terribly familiar with python, but why is line 2 *.5 instead of /2 ?

@jdstankosky The division operator in Python is by default integer division, so that if the sum of a+b+c is odd, the result will be erroneous. This did change in Python 3, although most golf submission are assumed to be Python 2.7 unless otherwise specified (just as Perl submissions are assumed to be 5.10+, and not Perl 6).

You could just say "Python 3" instead of "Python".

@JoeZ. Nope. This is Python 2; in Python 3, input() returns a string, breaking this solution.

R : 48 43 characters
f=function(...)prod(sum(...)/2-c(0,...))^.5

Using Heron's formula as well but taking advantage of R's vectorization.
Thanks to @flodel for the idea of the ellipsis.
Usage:
f(2,3,4)
[1] 2.904738
f(3,4,5)
[1] 6

you can drop the curly brackets. And you can gain more by using ellipsis: function(...)prod(sum(...)/2-c(0,...))^.5. Or even function(x)prod(sum(x)/2-c(0,x))^.5 if you call your function with a vector.

@flodel thanks! I didn't thought of the ellipsis, that's nice.

GolfScript, 38 characters
~].~++:d\{2*d\-*}/'"#{'\+'**0.5/4}"'+~

Since the question didn't specify otherwise I chose to work only on integer lengths. Sides must be given on STDIN separated by spaces.
Example:
> 2 3 4
2.9047375096555625

Mathematica 20 16 or 22 18 bytes
With 4 bytes saved by @swish.
This returns an exact answer:
Area@SSSTriangle@

Example
Area@SSSTriangle[2,3,4]

To return the answer in decimal form, two additional bytes are required.
N@Area@SSSTriangle[2,3,4]

2.90474

Composition shaves couple of bytes Area@*SSSTriangle

@swish Thanks, Much appreciated.

@swish, the multiplication operation, represented by an asterisk, should be dropped.  (I suspect you know that.)

APL, 23 20 characters
{(×/(+/⍵÷2)-0,⍵)*÷2} 2 3 4

Example:
> {(×/(+/⍵÷2)-0,⍵)*÷2} 2 3 4
2.90474

K, 23
{sqrt s**/(s:.5*+/x)-x}

Example
k){sqrt s**/(s:.5*+/x)-x} 2 3 4
2.904738

Javascript, 88 85
v=prompt().split(/,/g);s=v[0]/2+v[1]/2+v[2]/2;Math.sqrt(s*(s-v[0])*(s-v[1])*(s-v[2]))

Not good but fun :) Also Heron...
Demonstrates the ungolfability of simple problems in JS lol
Note: run from console to see result.
88->85: Removed a, b and c.

You can save a bit by only dividing by 2 once. And you don't actually gain anything by assigning to variables: (a=v[0])a is longer than v[0]v[0].

If I divided by 2 only one time, like s=(v[0]+v[1]+v[2])/2 with a,b,c=3,4,5 would result in "345"/2=172.5" and not 6. Improved without a, bandc` though.

Ah, JavaScript's wonderful type system. Ok, s=(-v[0]-v[1]-v[2])/2 and change the other - to +. It's an even number of terms, so it cancels out.

C (gcc), 55 bytes
#define f(a,b,c)sqrt((a+b+c)*(a+b-c)*(a-b+c)*(b+c-a))/4

Try it online!
Yet another implementation of Hero's formula.

Jelly, 7 bytes
SH;_P½ʋ

Try it online!

PHP, 78 77
<?=sqrt(($s=array_sum($c=fgetcsv(STDIN))/2)*($s-$c[0])*($s-$c[1])*$s-=$c[2]);

Useage:
php triangle.php
2,3,4

Output: 2.9047375096556
I don't think I can make it shorter? I'm still new to golfing. Anyone let me know if I overlooked something.
Thanks Primo for saving me 1 byte, lol.

The final ($s-$c[2]) can be replaced with $s-=$c[2] for one byte, but that's all I can see.

Haskell: 51 (27) characters
readLn>>=(\l->print$sqrt$product$map(sum l/2-)$0:l)

A very straight-forward implementation of Heron's formula. Example run:
Prelude> readLn>>=(\l->print$sqrt$product$map(sum l/2-)$0:l)
[2,3,4]
2.9047375096555625
Prelude>

Note that it accepts any numeric input, not only integers. And if the input already is in l the solution only needs to be 36 characters long, and if we are not interested in printing the answer the solution only needs to be 30 characters long. What more is that if we can allow ourself to change the input format we can remove 3 more characters. So if our input looks like [2,3,4,0.0] and is already in l we can get our answer with only:
sqrt$product$map(sum l/2-)l

Example run:
Prelude> let l = [2,3,4,0.0]
Prelude> sqrt$product$map(sum l/2-)l
2.9047375096555625
Prelude>

JavaScript (84 86)
s=(eval('abc '.split('').join('=prompt()|0;'))+a+b)/2;Math.sqrt(s*(s-a)*(s-b)*(s-c))

Another JavaScript solution based on Heron's formula, but trying a different approach for loading variables.  Needs to be run from the console.  Each side is entered in a separate prompt.
EDIT: Make use of return value of eval to save 2 characters.  Beats @tomsmeding, wahoo! :)

Tcl, 74 chars.
proc R {a b c} {set s ($a+$b+$c)/2.
expr sqrt($s*($s-$a)*($s-$b)*($s-$c))}

Pass the sides as argument.
For the input 2 3 4 the value of s is (2+3+4)/2. as string. Double evaluation FTW.

As a proc, it extends to only 81 bytes:
https://tio.run/##NYo7CoAwEAV7T/GKLYyigp@L2EqKZEknGLMRBPHsMaAWwzAwkdeUfNgYMy4DC75xiYsQlGRqsjWx6vq28EcULO70AbKHWJJUmYaMem0/s1L6Tu89o8eAURd/5sCk0wM

TI-BASIC, 14 12 bytes
4⁻¹√(sum(Ansprod(sum(Ans)-2Ans

Starting from a Heron's Formula routine written by Kenneth Hammond (Weregoose), I golfed off two bytes. Note that TI-BASIC is tokenized, and each token, like Ans and prod(, is one or two bytes in the calculator's memory.
Input through Ans i.e. in the form {a,b,c}:[program name].
Explained:
                   sum(Ans)-2*Ans   (a+b+c)-2{a,b,c}={b+c-a,c+a-b,a+b-c}
          Ans*prod(                 {a,b,c}*(b+c-a)(c+a-b)(a+b-c)
      sum(                          (a+b+c)(b+c-a)(c+a-b)(a+b-c)
4⁻¹*√(                              √((a+b+c)(b+c-a)(c+a-b)(a+b-c)/16)
                                    =√(s(s-a)(s-b)(s-c))

I've converted this to a community wiki as it isn't your own work. We don't really have a solid consensus on this, but feel free to weigh in here if you disagree with my decision.

Julia 0.6.0, 48 bytes
Basically heron's formula:
f(a,b,c)=(p=(a+b+c)/2;sqrt(p*(p-a)*(p-b)*(p-c)))

Japt, 17 16 15 bytes
½*Nx
NmnU ×*U q

Test it
Saved 2 bytes thanks to ETH pointing out a redundant newline and some alternative ways to reduce the array.

I think you can use any of these for the second line, too: NmnU ×*U q, NmnU r*U q, Np0 mnU ×q

Excel, 42 bytes
Based on Heron's formula, high school algebra to golf.
=SQRT(((A1+B1)^2-C1^2)*(C1^2-(A1-B1)^2))/4

Ungolfed / Unalgebra'ed
=SQRT((A1+B1+C1)/2*(((A1+B1+C1)/2)-A1)*(((A1+B1+C1)/2)-B1)*(((A1+B1+C1)/2)-C1))

dc, 34 bytes
9ksssddlsld++2/d3R-rdls-rdld-***vp

Try it online!

ARBLE, 36 bytes
sqrt(a*(a-b)*(a-c)*(a-d))((b+c+d)/2)

Heron's formula.
Try it online!

Perl 5 -MList::Util=sum -ap, 40 bytes
$r=$t=.5*sum@F;map$r*=$t-$_,@F;$_=sqrt$r

Try it online!

Stax, 10 bytes
╝0∞♀»♦▓y╩╪

Run and debug it
Operates triples of floating point numbers.  Uses Heron's Formula

APL(NARS), 16 chars, 32 bytes
{√×/(+/⍵÷2)-0,⍵}

One has to cenvert the Erone formula if a, b, c are sides of triangle
p   =(a+b+c)/2
Area=√p*(p-a)(p-b)(p-c)

to APL language... test
  f←{√×/(+/⍵÷2)-0,⍵}
  f 2 3 4
2.90473751
  f 3 4 5
6

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


text:
Find the Convex Hull of a set of 2D points
When you hammer a set of nails into a wooden board and wrap a rubber band around them, you get a Convex Hull.

Your mission, should you decide to accept it, is to find the Convex Hull of a given set of 2D points.

Some rules:

Write it as a function, the point's list coordinates (in any format you want) is
the argument
The output must be the list of points in the convex hull listed
clockwise or anticlockwise, starting at any of them
The output list can be in any reasonable format where each point's coordinates are clearly distinguishable. (For example NOT a one dim list { 0.1, 1.3, 4, ...})
If three or more points in a segment of the convex hull are
aligned, only the two extremes should be kept on the output

Sample data:
Sample 0
Input:
{{1, 1}, {2, 2}, {3, 3}, {1, 3}}

Output:
{{3, 3}, {1, 3}, {1, 1}}

(The figures are just illustrative)
Sample 1
Input:
{{4.4, 14}, {6.7, 15.25}, {6.9, 12.8}, {2.1, 11.1}, {9.5, 14.9},
 {13.2, 11.9}, {10.3, 12.3}, {6.8, 9.5}, {3.3, 7.7}, {0.6, 5.1}, {5.3, 2.4},
 {8.45, 4.7}, {11.5, 9.6}, {13.8, 7.3}, {12.9, 3.1}, {11, 1.1}}

Output:
{{13.8, 7.3}, {13.2, 11.9}, {9.5, 14.9}, {6.7, 15.25}, {4.4, 14},
 {2.1, 11.1}, {0.6, 5.1}, {5.3, 2.4}, {11, 1.1}, {12.9, 3.1}}

Sample 2
Input:
{{1, 0}, {1, 1}, {1, -1}, {0.68957, 0.283647}, {0.909487, 0.644276},
 {0.0361877, 0.803816}, {0.583004, 0.91555}, {-0.748169, 0.210483},
 {-0.553528, -0.967036}, {0.316709, -0.153861}, {-0.79267, 0.585945},
 {-0.700164, -0.750994}, {0.452273, -0.604434}, {-0.79134, -0.249902},
 {-0.594918, -0.397574}, {-0.547371, -0.434041}, {0.958132, -0.499614},
 {0.039941, 0.0990732}, {-0.891471, -0.464943}, {0.513187, -0.457062},
 {-0.930053, 0.60341}, {0.656995, 0.854205}}

Output:
{{1, -1}, {1, 1}, {0.583004, 0.91555}, {0.0361877, 0.803816},
 {-0.930053, 0.60341}, {-0.891471, -0.464943}, {-0.700164, -0.750994},
 {-0.553528, -0.967036}}

Standard code-golf rules apply. No ad-hoc geometry libraries. Shorter code wins.
Edit 1
We are looking for an algorithmic answer here, not a convex hull finder pre-programmed routine like this one in MatLab or this one in Mathematica
Edit 2
Answering comments and additional info:

You can assume the input list contains the minimum number of points
that suits you. But you must ensure proper treatment of aligned (sub)sets.
You may find repeated points in the input list
The maximum number of points should be limited only by the available memory
Re "floating point": You need to be able to process input lists with
decimal coordinates as those given in the samples. You could do that by using a floating point representation

.

I predict that MATLAB will win this one.

Can we assume that there are at least 3 points? Can we assume that the points are distinct? Are we required to support floating point coordinates?

@PeterTaylor the example indicates the last answer is true

May we overwrite the input?

The problem with treating collinear points consistently is there are rounding issues. We should be allowed to make mistakes.

@JanDvorak 1) You can overwrite the input if that is useful for you. 2) Collinearity detection: perform it up to your rounding ability, or use http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic if you dare

@belisarius so, I am allowed to assume floats are infinitely precise

@JanDvorak Yes.

You might also want reasonable running time (eg. under 1 sec for examples) to avoid brute force check-every-possibility solutions.

@randomra Why not allow brute-force solutions? I don't think they can get substantially shorter than polynomial solutions.

@randomra No time limits, No specific algorithm requirement. Brute force it if that makes you happy :)

Yes, that answers my questions. Thanks.

There's a typo in sample 1.  The output contains a point {9.5,14.9} but no such point exists in the input.  I think the {9.5,4.9} in the input is supposed to be {9.5,14.9}.

@cardboard_box Thank you! The "1" was unintentionally deleted while editing the list

Ruby, 168 characters
C=->q{r=[]
f=m=q.sort[0]
t=-0.5
(_,_,t,*f=q.map{|x,y|a=x-f[0]
b=y-f[1]
[0==(d=a*a+b*b)?9:(-t+e=Math.atan2(b,a)/Math::PI)%2,-d,e,x,y]}.sort[0]
r<<=f)while
!r[1]||f!=m
r}

This ruby code also uses the gift wrapping algorithm. The function C accepts an array of points and returns the convex hull as array.
Example:
>p C[[[4.4, 14], [6.7, 15.25], [6.9, 12.8], [2.1, 11.1], [9.5, 14.9],
     [13.2, 11.9], [10.3, 12.3], [6.8, 9.5], [3.3, 7.7], [0.6, 5.1], [5.3, 2.4],
     [8.45, 4.7], [11.5, 9.6], [13.8, 7.3], [12.9, 3.1], [11, 1.1]]]

[[5.3, 2.4], [11, 1.1], [12.9, 3.1], [13.8, 7.3], [13.2, 11.9], [9.5, 14.9], [6.7, 15.25], [4.4, 14], [2.1, 11.1], [0.6, 5.1]]

 Mathematica 151  still work in progress
f = For[t = Sort@#; n = 1; l = Pi; a = ArcTan; c@1 = t[[1]],
       n < 2 || c@n != c@1,
       n++,
      (l = a @@ (# - c@n); c[n + 1] = #) & @@
      t[[Ordering[Mod[a@## - l, 2 Pi] & @@ (#2 - #1) & @@@ Tuples@{{c@n}, t}, 1]]]] &

testing:
ClearAll[a, c, t];
s = {{1, 0}, {0.68957, 0.283647}, {0.909487, 0.644276}, {0.0361877, 0.803816},
     {0.583004, 0.91555}, {-0.748169, 0.210483}, {-0.553528, -0.967036},
     {0.316709, -0.153861}, {-0.79267, 0.585945}, {-0.700164, -0.750994},
     {0.452273, -0.604434}, {-0.79134, -0.249902}, {-0.594918, -0.397574},
     {-0.547371, -0.434041}, {0.958132, -0.499614}, {0.039941, 0.0990732},
     {-0.891471, -0.464943}, {0.513187, -0.457062}, {-0.930053, 0.60341},
     {0.656995, 0.854205}};
f@s
Show[Graphics@Line@Table[c@i, {i, n}],
     ListPlot[{t, Table[c@i, {i, n}]},
     PlotStyle -> {PointSize[Medium], PointSize[Large]},
     PlotRange -> All]]

CoffeeScript, 276:
f=($)->z=$[0];e.r=Math.atan2(e.x-z.x,e.y-z.y)for e in $;$.sort((x,y)->(x.r>y.r)-(x.r<y.r));(loop(a=$[i-1]||$[$.length-1];b=$[i];c=$[i+1]||$[0];break if!b;s=(b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x);break if s<0||!s&&(a.x-b.x)*(b.x-c.x)<0;$.splice i,1))for i in [$.length-1..0];$

If the function needs not be accessible, remove f= to shave off two more characters.
Input/output is a single array of points, with each point being defined by the x,y properties. The input array is modified, as well as returned (if the latter not required, remove the last two characters).
Explanation may be added later.
Test suite (won't work in oldIE):
alert JSON.stringify f({x:e[0], y:e[1]} for e in JSON.parse "
{{1, 1}, {2, 2}, ...}
".replace(/{/g,"[").replace(/}/g,"]"))

suggested test environment: http://coffeescript.org/

I tried it with {{1, 1}, {2, 2}, {3, 3}, {1, 3}} and it returned [{"x" : 1, "y" : 1, "r" : 0}, {"x" : 1, "y" : 3, "r" : 0}, "x" : 2,     "y" : 2, "r" : 0.78..}] while I think the correct answer is some permutation of {{3, 3}, {1, 3}, {1, 1}}

@belisarius issue with points collinear with the first one sometimes producing incorrect hull fixed

@belisarius please add this as a test case to the question.

It seems to work properly now :)

Python, 209 205 195
from math import*
s=lambda(a,b),(c,d):atan2(d-b,c-a)
def h(l):
 r,t,p=[],pi/2,min(l)
 while 1:
    q=min(set(l)-{p},key=lambda q:(s(p,q)-t)%(2*pi));m=s(p,q);r+=[p]*(m!=t);p=q;t=m
    if p in r:return r

Uses a gift wrapping algorithm.  The result starts with the leftmost point and wraps counter-clockwise.
Example: h([(1, 1), (2, 2), (3, 3), (1, 3)]) returns [(1, 3), (1, 1), (3, 3)]

Don't you need a print to get the output?

I thought by "output" you meant the output of the function.  Do you want the function to print the result instead of return it?

I thought that requiring the output list can be in any reasonable format was clear enough. Do you think it needs to be explicitly stated?

It seems your output points doesn't always match the input ones if floating point is used. For example h([(0, 1), (0,1), (0.1 , 1)]) gives me [(0, 1), (0.10000000000000001, 1)]

C++ (gcc), 327 301 bytes
#import<bits/stdc++.h>
using V=std::complex<double>;using W=std::deque<V>;W f(W x){V m=x[0],r,c;double v=imag(m),t,g,s=1;for(V a:x)c=m=imag(a-m)>0?a:m,v=fmin(imag(a),v);W p;do{p.push_back(r=c);g=4;for(V a:x)m=c=a!=r?t=std::arg(s*(a-r)),t<g|t==M_PI?g=t,a:c:c;s=imag(m)-v?s:-1;}while(m!=p[0]);return p;}

Try it online!
Another implementation of the gift wrapping algorithm. Slightly golfed less:
#import<bits/stdc++.h>
using V=std::complex<double>;
using W=std::deque<V>;
W f(W x){
  V m=x[0],r,c;
  double v=imag(m),t,g,s=1;
  // find topmost point
  for(V a:x)
    c=m=imag(a-m)>0?a:m,
    v=fmin(imag(a),v);
  W p;
  do{
    p.push_back(r=c);
    g=4;
    // loop to find the smallest angle t
    for(V a:x)
      m=c=a!=r?
        t=std::arg(s*(a-r)),t<g|t==M_PI?
          g=t,a
        :
          c
      :
        c;
    // are we wrapping over or under?
    s=imag(m)-v?s:-1;
  // loop until we've gone all the way around
  }while(m!=p[0]);
  return p;
}


text:
secret language hackerrank.com
I tried this contest: https://www.hackerrank.com/challenges/secret-language
Well, the score in this contest said I made 30 out of 30 points. As the score is calculated with the formula 30*(1000-#chars)/1000 this is impossible. Here is my code:
import sys,string as s
b='anbycoduepfxgqhvirjzkslwmt'
a=s.letters
b+=b.upper()
t=s.translate
m=s.maketrans
for l in sys.stdin:
 print{'N':t(l[7:],m(a,b)),'E':t(l[7:],m(b,a)),'O':''}[l[1]],

The contest is over, so asking is no cheating but I would like to get some realistic score. I have 187 chars with newline and 195 with cr-lf. For pythoncode 24.39 (assuming newline) isn't so bad, but I think it can be done better.
For completeness here is the challenge:
Bob and Fred pass notes to each other in class all the time. However their teacher started intercepting their messages and reading the messages out loud to the class. Undeterred, Bob and Fred decided to encode their messages before they pass them so that when the message is intercepted the teacher and class will not understand it.
They got together and decided on using a simple substitution cipher. The substition cipher they agreed upon is listed below:
Old Letter: ABCDEFGHIJKLMNOPQRSTUVWXYZ
New Letter: ANBYCODUEPFXGQHVIRJZKSLWMT
Using this key (Case matters!), A is changed to A, a is changed to a, B is changed to N, b is changed to n, C is changed to B, c is changed to b, … . All other characters remain the same.
However after Bob and Fred started using this method of note transfer they quickly realized that they are very slow at encoding and decoding messages. They have hired you to help them transfer messages faster by writing a program that will encode or decode messages using their substitution cipher. They want the code to be very portable so the smaller the source file is the better.
Input
Input will consist of several lines. Each line will begin with either the string “ENCODE”, “DECODE”, or “DONE”. If the string is “ENCODE” or “DECODE” then a message will follow. This is the message that you will have to either encode (if the first string is “ENCODE”) or decode (if the first string is “DECODE”). Messages will contain spaces and punctuation but will always be on the same line. If the string is “DONE” then this signifies that Bob and Fred are done exchanging messages.
Output
For each line that begins with “ENCODE” print the encoding of the message that follows.
For each line that begins with “DECODE” print the decoding of the message that follows.
Be sure to keep all capitolization and punctuation that is used in the message.
Sample Input
ENCODE This is a message.
DECODE Zuej ej a gcjjadc.
DONE
Sample Output
Zuej ej a gcjjadc.
This is a message.
Scoring
Your score will be 30 * (1000 - #characters) / 1000. The minimum score a correct solution will receive is 0.03.

A real test case would include a DONE followed by another message, which shouldn't be translated.

bash and friends (168 167 chars)
T=ANBYCODUEPFXGQHVIRJZKSLWMT
while read x&&[ "$x" != "DONE" ]
do
[ "$x" \> "E" ]
for((z=1+$?*58;z;z--))do
x=$(tr a-zA-Z `tr A-Z a-z<<<$T`$T<<<$x)
done
echo ${x:6}
done

The magic number isn't so magic: it's obtained by solving a set of simultaneous modular identities obtained from the cycle structure of the permutation.

:O Impressive math... albeit simple, awesome too.

K, 95
d:(,/.Q`A`a)!t,_t:"ANBYCODUEPFXGQHVIRJZKSLWMT"
while[~"DONE"~f:0:0;-1@7_f^$[f like"E*";d@;d?]f]

Example
k)d:(,/.Q`A`a)!t,_t:"ANBYCODUEPFXGQHVIRJZKSLWMT"
k)while[~"DONE"~f:0:0;-1@7_f^$[f like"E*";d@;d?]f]
ENCODE This is a message.
Zuej ej a gcjjadc.
DECODE Zuej ej a gcjjadc.
This is a message.
DONE

GolfScript, 93 characters
n/{(.1=3%{;0}{(2*343+\6>1/{{..'ANBYCODUEPFXGQHVIRJZKSLWMT'.{32+}%+.@+1/\$@+@?=}%}@*n@1}if}do;

Example:
>ENCODE This is a message.
>DECODE Zuej ej a gcjjadc.
>DONE
>ENCODE This line is not processed

Zuej ej a gcjjadc.
This is a message.

Note: Due to the nature of i/o the input is read completely before processing and output starts.

Python, 159
from string import*
n='anbycoduepfxgqhvirjzkslwmt'
r=raw_input
s=r()
while'N'>s[2]:print translate(s[7:],maketrans(*(letters,n+upper(n))[::1-2*('E'>s)]));s=r()

Thank you, I didn't expect raw_input to work as I always thought it must be commited by a CR(newline). Especially I like the trick with reversing the arguments for the maketrans method.


text:
Find all the numbers have this property, its double and its triple contain each digit from 1 to 9 exactly once
192 is such a number, together with its double (384) and triple (576) they contain each 1-9 digit exactly once. Find all the numbers have this property.
No input.
Output:
192 384 576
219 438 657
273 546 819
327 654 981

The problem with golfing this kind of problems is that they don't need a real program. Just printing 192 219 273 327 would do.

192384576*3 = 577153728 which contains some digits twice and others not at all.

I think you should rephrase to question to something like: 192 is such a number; together with its double (384) and triple (576) they contain each 1-9 digit exactly once.. The current form is a bit misleading

GolfScript (31 30 chars)
1246`{[27*1131-..2*\3*]' '*n}/

(thanks to Howard for 31->30); or for a non-hard-coded approach, 33 32 (thanks again to Howard) chars:
333,{[..2*\3*]' '*}%{.&0-,9>},n*

If the output doesn't have to be character-for-character identical to the text in the question (i.e. if that is a sample), we can shorten to 27 chars:
[4.)7 9]{[27*84+..2*\3*]}%`

You may save a char and omit the back tick

And even shorten it to 31: 333,{[..2*\3*n]' '*..&0-,10>*}/.

@Howard, my current understanding of the question is that it's a Kolmogorov-complexity one: reproduce the exact string. Your 31-char solution would add trailing spaces to the lines. If we remove the exact string restriction then there are certainly places that savings can be made.

I didn't read that in the specification - only to somehow have the correct output format. You may be right, but the formulation simply doesn't read reproduce the exact string to me.

Following your argument you must recall one of your first two solutions: one has a trailing newline and one hasn't ;-)

Your hard-coded version can be one char shorter: 1246`{[271131-..2*\3*]' 'n}/.

APL (20)
192 219 273 327∘.×⍳3

Just prints the numbers multiplied by 1, 2, and 3.
Without hardcoding (25)
{∧/1↓⎕D∊⍕k←⍵×⍳3:⎕←k}¨⍳400

I don't know APL... can you take advantage of the fact that 192 and 273 can be rotated 1 to the right to obtain 219 and 327 respectively?

odd... that holds for all numbers of both sequences

@boothby: You're thinking like an APL programmer, but unfortunately, in this case that would be longer than just writing them out, especially since the rotation itself isn't constant.

What do you mean the rotation isn't constant?

GolfScript 44 39
Here's a program that's slightly shorter than the trivial (just print the numbers) solution:
333,{4,(;{1$*}%\;.''*$10,0-''*={.p}*;}/

(thanks Howard & Peter)
v1:
333,{3,{)}%{1$*}%\;.''*$9,{)}%''*={p}{;}if}/

Online test here.

In your case you can shorten {p}{;}if into {.p}*;.

And two others: 3,{)}% -> 4,0- and same with 9,{)}%.

Or 4,(;, which would be more useful if the token following were a positive integer.

Or of course 4,1> which fulfills the same.

Python: 84 77 73 characters
for i in range(328):
 if`set(`i`+`i*2`+`i*3`)-{'0'}`[45:]:print i,i*2,i*3

192 384 576
219 438 657
273 546 819
327 654 981

That's some fine golfing, my friend.  I do not understand how python parses those backticks...

@boothby Nobody ever uses them since they were a bad idea in the first place but all they do is call repr(). It's the shortest way i could think of to concatenate the numbers

Oh, backticks are a good idea and quite familiar.  But... the way you've nested them is just evil.

Haskell: 55 characters
[(i,2*i,3*i)|i<-[0..333],9==length(nub$show$1002003*i)]

Or 65 characters if it is to be compiled and not just interpreted:
main=print[(i,2*i,3*i)|i<-[0..333],9==length(nub$show$1002003*i)]

Save 1 by moving the parenthesis to length(nub$show$1002003*i). Also, the use of $ to apply print is redundant.

Ruby: 76 65 60 characters
(99..999).map{|n|s=[n,2*n,3*n]*" ";s=~/(\d).*\1|0/||puts(s)}

Sample run:
bash-4.2$ ruby -e '(99..999).map{|n|s=[n,2*n,3*n]*" ";s=~/(\d).*\1|0/||puts(s)}'
192 384 576
219 438 657
273 546 819
327 654 981

In this case $_=[n,2*n,3*n]*" " is much shorter.

Another one: put the no-zero part into the first regex: /(\d).*\1|0/.

C#, 109 characters
String.Format("{0}{1}{2}",a,a*2,a*3).Length ==9 && String.String.Format("{0}{1}{2}",a,a*2,a*3).Distinct()==9;

Welcome to Programming Puzzles & Code Golf, @ZafarYousafi. Please note that code golf is a challenge of writing the shortest code possible. That means, here we write unindented and almost unreadable code and force the limits of the language syntax to shorten our codes as possible.


text:
Incrementing Numbers, Over Multiple Sessions
Good Evening Golf Agents,
Your mission is on behalf of notorious entertainment giant Eviltronic Arts. As part of their nefarious plan for world enslavement and entertainment, they must sell as many copies of SimStation V as possible. This means that the software must mysteriously stop working, after starting it a few times.
Your goal is to write a program that counts the amount of times it has been run. The program must do nothing other then write the integer to stdout. The first time it is run, it should return "1". The next "2" and so on. The program must be able to at least reach the number "14", but there is no required upper limit.
However, your program must not write any new files. Accessing itself, or the registry, or even the internet is absolutely OK. But some of our users are suspicious of new files, and will merely overwrite them! The nerve! Defeating the limitations on software they legitimately purchased!
The program can not assume a stable interpreter or shell - the program must still work if the entire interpreter nay shell nay computer is restarted between running.
As it must be as undetectable as possible, the shortest source code will win.
Good luck agents. The entertainment industry is counting on you.

Related.

bash script, 39,37,21 18
wc -l<$0;echo>>$0

Short and sweet, my first submission in code golf :)

Replace echo with id :D

it appends unnecessary output to file, which will be redirected to stderr

Huh? There's nothing here that interacts with stderr. But right, it makes the file grow larger over time.

can be golfed to 17: Replace the ; with newline and remove the trailing newline. It will even look a lot nicer :-)

Is only the starting size of the script relevant? Considering that this will increase in size every run.

@unclemeat relevant is the size of the program that meets the rules. Does the shortest code (17 chars as I proposed) meet the rules? Obviously yes.

@Tomas If i remove ';' with '\n', it would produce 2 for first run. Correct me if i have missed something.

Have you removed the trailing \n?

Python, 40, 39, 38 characters
Also there is no such upper limit on the runtime:
open(__file__,'a').write("+1");print 1

As you can see, the size of the program gradually increases but there was no such restriction in the original problem. I believe, size of the submitted program is all what matters

I don't think you need to put a+, a should work fine.

PHP 48 bytes
<?=$n=1 ;fputs(fopen(__FILE__,c),'<?=$n='.++$n);

A simple self modifying approach. After running 99 times, it will crash spectacularly.
$ php increment.php
1
$ php increment.php
2
$ php increment.php
3

⋮
$ php increment.php
97
$ php increment.php
98
$ php increment.php
99
$ php increment.php
PHP Parse error:  syntax error, unexpected T_STRING, expecting ',' or ';' in increment.php on line 1

isn't the single whitespace unneccessary?

@JanDvorak The single whitespace is necessary in the program, otherwise it would crash after just 10 executions, which doesn't meet the specification. After the 100th execution the semicolon is overwritten, which causes the syntax error.

Got PHP solution for 35 chars, wanna beat me? :)

bash script, 37
n=1;echo $n;sed -ie s/$n/$((n+1))/ $0

Ruby: 31 21 characters
(This is a rewrite of Abhijit's Python solution. If you like the base idea, upvote his answer, like I did.)
open($0,?a)<<"+1";p 1

Sample run:
bash-4.2$ ruby increment.rb
1

bash-4.2$ ruby increment.rb
2

bash-4.2$ ruby increment.rb
3

Using << you can save some chars: open($0,?a)<<"+1";p 1\

Doh. The good old habit of ensuring the data files get closed… :( Thank you, @steenslag.

*sh, 14
curl copy.sh/x

Using a web service, a different approach than the other existing solutions so far. Limit: The memory of my machine.

JavaScript, 40
alert(localStorage.a=~~localStorage.a+1)

Hardly counts as a program, but it's quite long anyways. Does not work in Firefox in a local file. Limit: 2^31.

Why not alert(localStorage.a=~~localStorage.a+1) 41 and technically speaking the javascript program would be without the script tags which would be only 33

@DavidMulder Oh, right

Down to 33: alert((l=localStorage).a=~~l.a+1)

@nitro2k01: Seems I copied the wrong stuff, cause that was the 33 I was talking about O:) 41 was the same thing including script tags~ (well, I did the decleration before the alert, cause it's just as long: a=localStorage;alert(a.b=~~a.b+1) though yours looks nicer :D

I had forgotten about localStorage until I saw this...  Correct me if I'm wrong here, the ~~ is used to define l.a on the fly if a default value hasn't existed before, am I right, @copy?

@WallyWest Nope, it's actually bitwise invert and abuses JavaScript's weird type conversion rules

Gotta love JavaScript abuse! ;)

You can make a reference to localStorage and change ~a+1 to -~a: alert((l=localStorage).a=-~l.a). Saves 9 bytes

PHP 31 37 characters
Self modifying. It counts in unary. Be careful that your text editor doesn't try to be helpful and insert a newline character after the 1. It will only work (properly) in PHP < 5.3.2 because it relies on php to close open file descriptors on shutdown. Or is it acceptable to leak file descriptors?
<?fputs(fopen(__FILE__,a),1)?>1

Original version (36 chars), all PHP versions:
<?file_put_contents(__FILE__,1,8)?>1

"It counts in unary"... Best Golf Hack I've seen for a long time!

I challenge you. PHP solution for 35 chars, and it's in decimal :)

Wow, I see you have beaten me with your own method! Congratulations! :-) And thanks for the improvement of my method. I have included it in my answer and gave you a credit for that.

@Tomas I owe you credit. If you hadn't challenged me, I wouldn't have looked at this answer again.

Tim, that's exactly the joy and excitement of challenging each other! :)

Python, 50
n=1;
print n
open(__file__,'r+').write("n="+`n+1`)

It uses the same approach as primo's answer and similarly crashes on the 100th run.

J (58)
You need to run this as a script, it will not work from the J command line obviously.
echo m=.1
exit(;:^:_1(<":m+1)(<3)};:1!:1[k)1!:2[k=.1{ARGV

In J, the tokenizer that the interpreter uses is available as the ;: function, so if x contains J code, ;:x contains the J tokens, i.e.:
    ;: 'echo 1 2 3+4 5 6'
+----+-----+-+-----+
|echo|1 2 3|+|4 5 6|
+----+-----+-+-----+

So:

echo m=.1: set m to 1, and write it to the screen
k=.1{ARGV: store the 2nd element in ARGV (the script name) in k.
...1!:2[k: write the following string to the file in k:
;:1!:1[k: read k, the current script, and tokenize
(<":m+1)(<3)}: replace the 3rd token by the string representation of m + 1
;:^:_1: run the tokenizer in reverse, producing a string
exit: exit the interpreter (it doesn't do that by itself even if you run a script)

PHP, 34 33 chars
<?=$_SESSION[A]+=session_start();

Thanks to Tim for the update!
My old solution:
<?=session_start()+$_SESSION[A]++;

The problem is that $_SESSION[A] is "" - empty string - in first iteration, but as session_start() returns 1, you can add it and kill two or three flies in one shot!
Solution with correct syntax (35 chars):
<?=session_start()+$_SESSION[A]++?>

I will hold of judgement for a second for two reasons. "However, your program must not write any new files.": I am not sure if this isn't a problem for this solution, since opening a session creates a temporary file. Also the default session gc happens after 24 minutes. Does that really count as "over multiple sessions" then? Maybe the OP can comment.

Tim, the program doesn't write any files. I am not responsible for what the interpreter does. It's the same as HTML page is not responsible for browser creating some files in the cache, sql query is not responsible for created temporary tables on disk etc. As for the timeout, it was not specified in the rules :) Anyway, I am not sure why but on my machine the counter still holds for more than several hours!!!

Yeah, that's why I am saying I will wait to see what the OP thinks. You definitely found a very grey area. You don't need the closing php tag btw. so your 34 char version is sufficient. I have an idea for an improvement, but I will need to test it first.

Okay, I got it down to 33 chars. I dare you to do better. ;)

@TimSeguine Aaaah, what a change in your tone! :-) Now you don't care about the rules in my post so much! :-D

+1 I kept my own answer intact, I just decided I could beat you at your own game. :P

Okay, I got my unary version down to 31 characters. Feel free to use the improvement I noticed (+=) for yours, or come up with an even shorter version. ;)

I'm not sure. My gut says that it looks invalid to me. The other PHP answer does prove that PHP can handle the problem. Thoughts by others? I'm no despot, so I'm willing to listen - but like I said, my gut says no.

@Lochok "The program can not assume a stable interpreter or shell - the program must still work if the entire interpreter nay shell nay computer is restarted between running." This solution doesn't exactly qualify under those restrictions. You don't even need to restart the computer - just wait 30 minutes between execution, and the session will have reset.

@primo nope, the solution still works after several hours - I guess it uses some kind of permanent cookies.

@Tomas session.gc_maxlifetime = 1440 is the default value, i.e. 24 minutes. Also, this program never stops working, which is a primary requirement of the problem - in case you missed it.

No closing tag is perfectly valid; it´s even recommended (to prevent trailing whitespace in the output). And this doesn´t work over multiple sessions; the reason why it still works after hours is either the session_timeout setting or the fact that you don´t call anything else on that server in the meantime. Btw. @everyone: $_SESSION[A] is not an empty string in the first call, but NULL; but that evaluates to empty string for output. +1 for creativity, -1 for not completely satisfying the rules.

Haskell - 36 bytes
main=do appendFile"a.hs""+1";print$1

Simply adds +1 to the end of the source file, which is assumed to be named a.hs. The .hs extension is mandatory in both ghc and ghci.

Python, 49 48 characters
I realized this will only be 48 chars on Windows due to the \r\n. Otherwise it should be 49.
n=1

print n;print>>open(__file__,'r+'),"n=",n+1

A cheap ripoff of the method by @grc

C, 190 Characters . Works only on Win NT
#include <stdio.h>
int main(int c,char *v[]){
char f[100];sprintf(f,"%s:s",v[0]);
if (FILE *fp=fopen(f,"r"))fscanf(fp,"%d",&c);
FILE *fp=fopen(f,"w");printf("%d",c-1);fprintf(fp,"%d",++c);
}

I think its pretty simple how its working, but still if required I can add an explanation :-)

C#, 142 characters
int v=(Microsoft.Win32.Registry.CurrentUser.GetValue("c") as int?)??0+1;Console.Write(v);Microsoft.Win32.Registry.CurrentUser.SetValue("c",v);

You could use a shorter name like z, would get you a few chars down.

You should also remove the whitespace.

Instead of calling long API name each time, store it in a variable like: var a = Microsoft.Win32.Registry.CurrentUser;         a.GetValue(); a.SetValue();

Tcl, 63 or 73 bytes

With some web service it's 73:
package require http
puts [set [http::geturl http://example.com/c](data)]

modifying itself is 63:
proc a a {puts [string le $a]};puts -nonewline [open $argv0 a] a; a a

TI-Basic, 9 chars
:X+1->X:X

C# - 201 239 234 chars
Works for the first 255 times, then wraps over to 0.
It won't output anything on the first execution.
namespace System.IO{class s{static void Main (string[]a){char f='|';if(f!='|'){Console.Write (255);}string p=Reflection.Assembly.GetCallingAssembly().Location;byte[]d=File.ReadAllBytes(p);d[769]++;d[780]++;File.WriteAllBytes(p,d);}}}

Save as Main.cs, compile with
gmcs Main.cs

Tested with gmcs 2.10.8.1 and Mono runtime 2.10.8.1-5ubuntu2

Actually - I did. "The program must be able to at least reach the number 14"

It works now for 255 times.

Batch - 41
Given the example use case I probably wouldn't assume that this technique is a viable one - It renames the .bat file containing the script -
@set/aa=%~n0+1
@echo %a%&@ren %0 %a%.bat

Save this to a file called 0.bat - and call using 0.bat 2>nul. 2>nul redirects stderr to nul which is necessary because this script will rename the file containing the script, once it does that cmd can obviously no longer see the script (before it hits EOF) and will return the error The batch file cannot be found.
Each consecutive call of the script will of course have to be 1.bat 2>nul ... 2.bat 2>nul ... 3.bat 2>nul ... etc ...

Based on this idea, you can do a variation of my php answer of counting in unary and I think it is even shorter than this.

mIRC script, 28/22 bytes
If put in "aliases" tab, "alias " can be omitted making 22 bytes.
alias x inc %i | echo -ag %i

Powershell, 47 Bytes
assumes script is named a.ps1
0
[int]$n,$t=(gc a.ps1)[0..1];,(++$n),$t>a.ps1

The script will overwrite itself replacing the 0 on the first line with 1,2,3 and so on.
could also save another 8 bytes by replaceing both instances of a.ps1 with 1 and saving the script as a file named 1 although this is a bit far out for me.
Replace second line with this if the file is not saved as 'a.ps1'.
[int]$n,$t=(gc($s=$MyInvocation.MyCommand.Name))[0..1];,(++$n),$t>$s

0 on first line to initialize the count
Linebreak provides the easiest way to split the file in two
[int]$n,$t=(gc a.ps1)[0..1]

this takes the file 'a.ps1' and reads it in as an array of lines, we then iterate through it with [0..1] and set that to the variables $n which is cast as [int] and $t respectively, so that the 0 on the first line becomes $n and the 'code' on the second line becomes $t
,(++$n),$t>a.ps1

This used the ,1,2 array notation, to create an array of two elements, one being the number stored in $n pre-incremented and outputted to stdout by the use of implicit brackets, the second being the second line of text from the file, and then also output it to the file named 'a.ps1'
as both input and output are arrays of strings there is minimal formatting required, and almost everything is assumed by the interpreter.

Zsh (no coreutils), 32 bytes
a=`<$0`
<<<$[$#a/2-15]
>>$0<<<:

(Note the trailing newline)
Uses the length of the script. On each invocation, the last line shown above will append : (identical to true) and a newline to the script, hence the /2.
Try it online!

GNU sed, 13 + 1(n flag) = 14 bytes
$=;$eecho>>s

Run: sed -nf s s
The assumption is that the source filename is called s. A trailing newline is needed after the code, which was counted in the bytes total. Explanation:
$=           # print the number of lines of the input file
$eecho>>s    # a shell echo call that appends an empty line to the source file 's'

Rust / cargo-script, 283 bytes
Oneliner:
use std::fs::File;use std::io::Write;fn main(){let c=     0; let mut v = vec![];::std::io::Read::read_to_end(&mut File::open("w").unwrap(),&mut v);let mut q=&mut File::create("w").unwrap();q.write(&v[..53]);q.write(format!("{:6}",c+1).as_bytes());q.write(&v[59..]);println!("{}",c);}

Save as w and run with cargo-script:
$ cargo-script script w
   Compiling w v0.1.0 (file:///home/vi/.cargo/script-cache/file-w-b4d6541706fabb11)
    (warnings skipped...)
    Finished release [optimized] target(s) in 1.47 secs
0
$ cargo-script script w
    (compilation output skipped)
1
$ cargo-script script w
...
2
$ cargo-script script w 2> /dev/null
3
$ cargo-script script w 2> /dev/null
4
$ cargo-script script w 2> /dev/null
5
$ cargo-script script w 2> /dev/null
6
$ cargo-script script w 2> /dev/null
7
$ cargo-script script w 2> /dev/null
8
$ cargo-script script w 2> /dev/null
9
$ cargo-script script w 2> /dev/null
10
$ cargo-script script w 2> /dev/null
11

Don't iterate too fast or it'll get stuck.
Partially ungolfed:
use std::fs::File;use std::io::Write;fn main(){let c=     0;
    let mut v = vec![];
    ::std::io::Read::read_to_end(&mut File::open("w").unwrap(),&mut v);
    let mut q = &mut File::create("w").unwrap();
    q.write(&v[..53]);
    q.write(format!("{:6}",c+1).as_bytes());
    q.write(&v[59..]);
    println!("{}", c);
}

Will break after 99999;


text:
Give the smallest number that has N divisors

Your function takes a natural number and returns the smallest natural number that has exactly that amount of divisors, including itself.
Examples:
f(1) =  1 [1]
f(2) =  2 [1, 2]
f(3) =  4 [1, 2, 4]
f(4) =  6 [1, 2, 3, 6]
f(5) = 16 [1, 2, 4, 8, 16]
f(6) = 12 [1, 2, 3, 4, 6, 12]
 ...
The function doesn't have to return the list of divisors, they are only here for the examples.

Is this code-golf or code-challenge?

Oops, forgot about that tag, code-golf!

A005179

APL, 25 24 23 characters
f←{({+/⍵=⍵∧⍳⍵}¨⍳2*⍵)⍳⍵}

Defines a function f which can then be used to calculate the numbers:
> f 13
4096

> f 14
192

The solution utilizes the fact that LCM(n,x)==n iff x divides n. Thus, the block {+/⍵=⍵∧⍳⍵} simply calculates the number of divisors. This function is applied to all numbers from 1 to 2^d ¨⍳2*⍵. The resulting list is then searched for d itself (⍳⍵) which is the desired function f(d).

19: {⍵⍳⍨(+/⊢=⊢∧⍳)¨⍳2*⍵}

I don't think you need to define f.

GolfScript, 29 28 characters
{.{\.,{)1$\%},,-=}+2@?,?}:f;

Edit: A single char can be saved if we restrict the search to <2^n, thanks to Peter Taylor for this idea.
Previous Version:
{.{\)..,{)1$\%},,-@=!}+do}:f;

An attempt in GolfScript, run online.
Examples:
13 f p  # => 4096
14 f p  # => 192
15 f p  # => 144

The code contains essentially three blocks which are explained in detail in the following lines.
# Calculate numbers of divisors
#         .,{)1$\%},,-
# Input stack: n
# After application: D(n)

.,          # push array [0 .. n-1] to stack
{           # filter array by function
  )         #   take array element and increase by one
  1$\%      #   test division of n ($1) by this value
},          # -> List of numbers x where n is NOT divisible by x+1
,           # count these numbers. Stack now is n xd(n)
-           # subtracting from n yields the result

# Test if number of divisors D(n) is equal to d
#         {\D=}+   , for D see above
# Input stack: n d
# After application: D(n)==d

{
  \         # swap stack -> d n
  D         # calculate D(n) -> d D(n)
  =         # compare
}+          # consumes d from stack and prepends it to code block

# Search for the first number which D(n) is equal to d
#         .T2@?,?    , for T see above
# Input stack: d
# After application: f(d)

.           # duplicate -> d d
T           # push code block (!) for T(n,d) -> d T(n,d)
2@?         # swap and calculate 2^d -> T(n,d) 2^d
,           # make array -> T(n,d) [0 .. 2^d-1]
?           # search first element in array where T(n,d) is true -> f(d)

Seems to go into an infinite loop for input 1.

My best solution so far borrows quite heavily from yours, to the extent that I think it deserves to be a comment rather than a separate answer.

Mathematica 38 36
(For[i=1,DivisorSum[++i,1&]!=#,];i)&

Usage:
(For[i=1,DivisorSum[++i,1&]!=#,];i)&@200

Result:
498960

Edit
Some explanation:

DivisorSum[n,form]  represents the sum of form[i] for all i that divide n.

As form[i] I am using the function 1 &, that returns always 1, so effectively computing the sum of the divisors in a terse way.

There was no code-golf tag so I gave a long answer! oops

@DavidCarraher I just guessed :)

I thought I knew what DivisorSum returns (the sum of the divisors) but I don't see how that is instrumental for answering the question posed. Would you explain how it works. BTW, I think you should include timing data for n=200; the function is remarkably fast, given all the numbers it had to check.

@DavidCarraher See edit. Re: timings - My machine is way toooo slow :(

Does Mathematica not have enough built-ins for the more sophisticated approach around factoring to be shorter? If that's the case, I'm disappointed.

@PeterTaylor Mathematica is very verbose, golfing with it is quite difficult. The mean "keyword" length is 13 characters.

You can remove ,  to save two characters.

+1 -- by the way, I realize this is code golf and you saved a character, but for practical use DivisorSigma[0, n] is faster.

@Mr.Wizard Thanks! And no, never compared them before (or at least I can't remember doing so). I'll try to remember that one

@belisarius  Mathematica is not verbose in the normal sense of the term (lots of words), but it does use big words, as you pointed out.

Python: 66
f=lambda n,k=1:n==sum(k%i<1for i in range(1,k+1))and k or f(n,k+1)

The above will raise a RuntimeError: maximum recursion depth exceeded with small inputs in CPython, and even setting the limit to a huge number it will probably give some problems. On python implementations that optimize tail recursion it should work fine.
A more verbose version, which shouldn't have such limitations, is the following 79 bytes solution:
def f(n,k=1):
    while 1:
        if sum(k%i<1for i in range(1,k+1))==n:return k
        k+=1

I'm hitting the recursion limit on 11, 13, 17, 19, and others.

@StevenRumbalski Nobody mentioned that the program should work with arbitrary integers. Unfortunately the numbers grow up pretty fast even with small inputs.

You can save some chars by using replacing if else with and or and ==1 with <1: f=lambda n,k=1:n==sum(k%i<1for i in range(1,k+1))and k or f(n,k+1)

Because I find 66 a little too evil, you can save 2 characters if you use sum(k%-~i<1for i in range(k))

f=lambda n,k=1:n==sum(k%-~i<1for i in range(k))or-~f(n,k+1) saves 7 bytes.

Python: 64
Revising Bakuriu's solution and incorporating grc's suggestion as well as the trick from plannapus's R solution, we get:
f=lambda n,k=1:n-sum(k%i<1for i in range(1,k+1))and f(n,k+1)or k

R - 47 characters
f=function(N){n=1;while(N-sum(!n%%1:n))n=n+1;n}

!n%%1:n gives a vector of booleans: TRUE when an integer from 1 to n is a divisor of n and FALSE if not. sum(!n%%1:n) coerces booleans to 0 if FALSE and 1 if TRUE and sums them, so that N-sum(...) is 0 when number of divisors is N. 0 is then interpreted as FALSE by while which then stops.
Usage:
f(6)
[1] 12
f(13)
[1] 4096

...7 years later, this question resurfaced in the 'Top Questions' page, so I gave it a shot, only to find that there was already this rather-similar R answer (from 7 years ago).  Anyway, save 10 bytes by using scan() for input and T as a pre-defined variable: n=scan();while(n-sum(!T%%1:T))T=T+1;T (37 bytes).

by the way, R is the language of the month for September 2020 on CGCC, in case you feel like doing a spot of golfing again...

@DominicvanEssen The question explicitely asks for a function though! Thanks nonetheless! I am afraid I don't have much time for golfing those days unfortunately but I might give it a try this weekend, thanks for the heads up!

Haskell 54
Quick and dirty (so readable and non-tricky) solution:
f k=head[x|x<-[k..],length[y|y<-[1..x],mod x y==0]==k]

The edit did not make the answer any shorter, but it is maybe more haskell-like. Also I have always included the trailing newline to my code length, is this wrong?

I thought you've miscounted; the main purpose for the edit was to update the count. The change in code itself was minor. I think the other entries here don't count the trailing newline either, like e.g. the entry for J (33 chars).

J, 33 chars
Fairly quick, goes through all smaller numbers and computes number of divisors based on factorization.
   f=.>:@]^:([~:[:*/[:>:_&q:@])^:_&1

   f 19
262144

Haskell (120C), a very efficient method
1<>p=[]
x<>p|mod x p>0=x<>(p+1)|1<2=(div x p<>p)++[p]
f k=product[p^(c-1)|(p,c)<-zip[r|r<-[2..k],2>length(r<>2)](k<>2)]

Test code:
main=do putStrLn$show$ f (100000::Integer)

This method is very fast. The idea is first to find the prime factors of k=p1*p2*...*pm, where p1 <= p2 <= ... <= pm. Then the answer is n = 2^(pm-1) * 3^(p(m-1)-1) * 5^(p(m-2)-1) ....
For example, factorizing k=18, we get 18 = 2 * 3 * 3. The first 3 primes is 2, 3, 5. So the
answer n = 2^(3-1) * 3^(3-1) * 5^(2-1) = 4 * 9 * 5 = 180
You can test it under ghci:
*Main> f 18
180
*Main> f 10000000
1740652905587144828469399739530000
*Main> f 1000000000
1302303070391975081724526582139502123033432810000
*Main> f 100000000000
25958180173643524088357042948368704203923121762667635047013610000
*Main> f 10000000000000
6558313786906640112489895663139340360110815128467528032775795115280724604138270000
*Main> f 1000000000000000
7348810968806203597063900192838925279090695601493714327649576583670128003853133061160889908724790000
*Main> f 100000000000000000
71188706857499485011467278407770542735616855123676504522039680180114830719677927305683781590828722891087523475746870000
*Main> f 10000000000000000000
2798178979166951451842528148175504903754628434958803670791683781551387366333345375422961774196997331643554372758635346791935929536819490000
*Main> f 10000000000000000000000
6628041919424064609742258499702994184911680129293140595567200404379028498804621325505764043845346230598649786731543414049417584746693323667614171464476224652223383190000

That's a poor golf score, but +1 for the path you've taken!

For 8=222 this algorithm give number 235=30. But best solution is 2^33=24 (for 8=24)

The solution is incorrect if the specified number of divisors contain a high power of small prime. So most likely listed solutions for powers of 10 are wrong.

@AMK Yes, you're right. Thanks for pointing that out.

Rust, 55 bytes
|n|(1..).find(|x|(1..*x).filter(|d|x%d<1).count()==n-1)

Try it online!
|n|                 //Number of divisors
  (1..)             //Infinite range starting at 1
    .find(|x|       //Find an x such that
      (1..*x)       //Possible divisors
        .filter(|d| //Keep the ones that
          x%d<1     //x is divisible by
        )
        .count()    //Count how many divisors there are (not including x)
         == n-1)     //Make sure there are n-1 of them

K, 42
Inefficient recursive solution that blows up the stack quite easily
{{$[x=+/a=_a:y%!1+y;y;.z.s[x;1+y]]}[x;0]}

.
k){{$[x=+/a=_a:y%!1+y;y;.z.s[x;1+y]]}[x;0]}14
192
k){{$[x=+/a=_a:y%!1+y;y;.z.s[x;1+y]]}[x;0]}13
'stack

APL 33
F n
i←0
l:i←i+1
→(n≠+/0=(⍳i)|i)/l
i

Example:
F 6
12

APL (25)
{⍵{⍺=+/0=⍵|⍨⍳⍵:⍵⋄⍺∇⍵+1}1}

Cheater! echo -n '{⍵{⍺=+/0=⍵|⍨⍳⍵:⍵⋄⍺∇⍵+1}1}' | wc -c gives me 47! But really, could you please give me a link to some easy tutorial for APL? I tried to google it and have read a few articles, but still in the end I always want to ask "Why are they doing this :( ?". I have never worked with any non-ASCII syntax language and want to find out if it has any real advantage.

This is for Dyalog APL, which is what I use, you can download the Windows version for free at the same site. http://www.dyalog.com/MasteringDyalogAPL/MasteringDyalogAPL.pdf

Wow, looks like I can really understand this one. Thank you for the link! The only downside is that they have some very strange licensing policy but maybe I just need to improve my english )

Haskell: 49 characters
It could be seen as an improvement of the earlier Haskell solution, but it was conceived in its own right (warning: it's very slow):
f n=until(\i->n==sum[1|j<-[1..i],rem i j<1])(+1)1

It's quite an interesting function, for example note that f(p) = 2^(p-1), where p is a prime number.

The efficient, as opposed to short, way to calculate it would be to factor n into primes (with repetition), sort descending, decrement each one, zip with an infinite sequence of primes, and then fold the product of p^(factor-1)

@PeterTaylor Not necessary. For n=16=2222 solution is 2^33^15^1=120, not 2^13^15^17^1=210.

Javascript 70
function f(N){for(j=i=m=1;m-N||j-i;j>i?i+=m=j=1:m+=!(i%++j));return i}

Really there are only 46 meaningful characters:
for(j=i=m=1;m-N||j-i;j>i?i+=m=j=1:m+=!(i%++j))

I probably should learn a language with shorter syntax :)

N=>eval("for(j=i=m=1;m-N||j-i;j>i?i+=m=j=1:m+=!(i%++j));i")

C, 69 chars
Not the shortest, but the first C answer:
f(n,s){return--s?f(n,s)+!(n%s):1;}
x;
g(d){return++x,f(x,x)-d&&g(d),x;}

f(n,s) counts divisors of n in the range 1..s. So f(n,n) counts divisors of n.
g(d) loops (by recursion) until f(x,x)==d, then returns x.

C: 66 64 characters
An almost short solution:
i;f(n){while(n-g(++i));return i;}g(j){return j?!(i%j)+g(j-1):0;}

And my previous solution that doesn't recurse:
i;j;k;f(n){while(k-n&&++i)for(k=0,j=1;j<=i;k+=!(i%j++));return i;}

Much shorter solutions must exist.

Brachylog, 2 bytes
fl

Try it online!
Takes input through its output variable and outputs through its input variable.
f     The list of factors of
      the input variable
 l    has length equal to
      the output variable.

This exact same predicate, taking input through its input variable and outputting through its output variable, solves this challenge instead.

Nice, but not eligible for that puzzle as the language is more recent than the question.

When I was new here one of the first things I was told was that languages newer than questions aren't noncompeting anymore, and this is backed up by meta: https://codegolf.meta.stackexchange.com/questions/12877/lets-allow-newer-languages-versions-for-older-challenges

Oh well, nevermind then. Apparently, rules are made to evolve and we must keep in mind that this site main purpose is to improve ourselves and have fun. Answer accepted!

Husk, 6 bytes
€moLḊN

Try it online!
1 byte shorter than the previous Husk answer...
€           # index of first occurrence of input among
 m   N      # map over all natural numbers
  oLḊ       # length of list of divisors

Mathematica 38 36
(For[k=1,DivisorSigma[0, k]!= #,k++]; k)&

Usage
   (For[k = 1, DivisorSigma[0, k] != #, k++]; k) &[7]

(* 64 *)

First entry (before the code-golf tag was added to the question.)
A straightforward problem, given that Divisors[n] returns the divisors of n (including n) and Length[Divisors[n]] returns the number of such divisors.**
smallestNumber[nDivisors_] :=
   Module[{k = 1},
   While[Length[Divisors[k]] != nDivisors, k++];k]

Examples
Table[{i, nDivisors[i]}, {i, 1, 20}] // Grid

David, shorter and faster than Length@Divisors@n is DivisorSigma[0,n].

Thanks. I hadn't known about that use of DivisorSigma.

http://math.stackexchange.com/questions/1551959/why-does-a005179-smallest-number-with-n-factors-have-spikes-at-prime-numbers-o

Perl 6, 39 chars
{my \a=$=0;a++while $_-[+] a X%%1..a;a}

Example usage:

say (0..10).map: {my \a=$=0;a++while $_-[+] a X%%1..a;a}

(0 1 2 4 6 16 12 64 24 36 48)

Jelly, 6 bytes
2*RÆdi

Try it online! or verify all test cases.
How it works
2*RÆdi  Main link. Argument: n (integer)

2*      Compute 2**n.
  R     Range; yield [1, ..., 2**n]. Note that 2**(n-1) has n divisors, so this
        range contains the number we are searching for.
   Æd   Divisor count; compute the number of divisors of each integer in the range.
     i  Index; return the first (1-based) index of n.

Why do you do 2*? Is it that every number after that has more divisors than n?

No; e.g., all primes have exactly two divisors. However, we are searching for the smallest positive integer with n divisors. Since 2**(n-1) belongs to that range, the smallest one does as well.

5 bytes

Japt, 8 bytes
@¶Xâ l}a

Try it

@SteeveDroz There's no longer a thing called non-competing, as we decided to allow newer languages/implementations to compete in older challenges. (Apparently you already saw it once last year...)

I am so sorry, you are right. I must have forgotten. Are you stalking me?

Raku, 28 bytes
{(1…(*X%%^*+1).sum==$_)-1}

Try it online!

Setanta, 79 bytes
gniomh(n){k:=1nuair-a 1{a:=k le i idir(1,k+1)ma k%i a-=1ma a==n toradh k k+=1}}

Try it here!

Husk, 9 8 7 bytes
ḟȯ=⁰LḊN

Try it online!
-1 byte from Zgarb.
-1 byte from Jo King. (Simplifying range)
Explanation
▼fȯ=¹LḊḣΠ
       ḣΠ range from 1..factorial(n)
 f        filter values using the following predicate:
     LḊ   length of list of divisors
   =¹     = n.
▼         take the minimum value.

7 bytes by simplifying the range to all natural numbers

I managed to save one more byte using a different approach...

05AB1E, 7 bytes
-1 byte thanks to @ovs.
∞.ΔÑgQ

Try it online!
∞.ΔÑgQ  # full program
 .Δ     # find first...
∞       # natural number...
     Q  # which has...
        # implicit input...
   Ñg   # divisors
        # implicit output

6 bytes with .Δ (find first).

C++, 87 characters
int a(int d){int k=0,r,i;for(;r!=d;k++)for(i=2,r=1;i<=k;i++)if(!(k%i))r++;return k-1;}

Python2, 95 characters, Non-recursive
A bit more verbose than the other python solutions but it's non-recursive so it doesn't hit cpython's recursion limit:
from itertools import*
f=lambda n:next(i for i in count()if sum(1>i%(j+1)for j in range(i))==n)

Scala, 66 bytes
def f(n:Int,x:Int=1):Int=if(1.to(x).count(x%_<1)!=n)f(n,x+1)else x

Try it in Scastie

Ruby 2.7, 58 56 bytes
Fairly straightforward, checks number of divisors for every number up to 2^n
->n{(1..2**n).find{|a|(1..a).select{|b|a%b==0}.size==n}}

C, 59 bytes
i,n,d;f(x){for(n=i=x;n;++i)for(n=x,d=i;d;n-=!(i%d--));--i;}

Works when compiled in Debug mode in Visual Studio.
A readable version:
int i, n, d;
f(x)
{
    i = x; // start searching from x; could also start from 0
    do {
        n = x; // n counts downward; if it hits 0, found then number
        for (d = i; d != 0; d--) // check all divisors
            n -= (i % d == 0); // subtract 1 if divisible
        ++i;
    } while (n != 0);
    return i - 1; // compensate for 1 extra iteration
}

Thunno 2, 5 bytes
1ƘFl=

Try it online!
Explanation
1ƘFl=  # Implicit input
1Ƙ     # First integer where:
  Fl=  #  Divisor count equals input
       # Implicit output

AWK, 60 53 bytes
{for(t=0;c!=$1;){t++;for(c=i=0;i<t;)c+=t%++i<1}$1=t}1

Try it online!

-7 bytes thanks to @ceilingcat

I'm a bit unhappy about tio.run on this one... I was using $0 instead of $1 (which is basically the same in this example). But tio.run wasn't willing to reasign $0.
Furthermore the code above is handling multiple input, otherwise you could reduce it to 50 bytes by removing t=0 which would give :
{for(;c!=$1;){t++;for(c=i=0;i<t;)c+=t%++i<1}$1=t}1

AFAIK this should run using GAWK and not a POSIX compliant AWK. But while testing with --posix option it still worked (GNU Awk 5.1.1).
Any insight on that note is more than welcome.


text:
Find the generating function of a sequence
Given a set of space-delimited integers, you've gotta either return a function that can generate that sequence, or return "There isn't any such function".
Sample input:
"1 11 41 79"
 - x^3+x^2-1

"12 38 78"
 - 7x^2 + 5x

The operations that the functions can contain are: +-/* and exponentiation.
If anyone has any other ideas LMK. As this is a code-golf, the shortest code will win.

This is a generalized form of http://codegolf.stackexchange.com/questions/1729/polynomial-interpolation, but I don't blame you for missing that (who knows what polynomial interpolation even is?)

Also, why is this a popularity contest?

In fact there are at least three other questions asking for polynomial interpolation in addition to the one @beary605 mentions.

The answer to the first sequence should read -2x^3+22x^2-42x+23. The generator function you have will produce 1 11 35 79.

Also, the title is somewhat misleading. Generating functions generate sequences in the coefficients.

I've changed the criteria to code-golf. As all of the solutions will do exactly the same thing, I don't see a need for subjective evaluation.

Python 256 bytes
a=raw_input().split();r=range(len(a));m=[[(i+1.)**p for p in r]+[int(a[i])]for i in r]
for j in r:s=m[j];m=[map(lambda a,b:a-b*(i[j]-(i==s))/s[j],i,s)for i in m]
while~j:
 c=m[j][-1]
 if c:print('%+.15g'%c)[s>c>0:j>=c*c==1or 18]+('x^%d'%j)[:j*j],;s=0
 j-=1

Sets up a system of linear equations, matrix style, and then uses Gaussian elimination to solve. Quite a few bytes are spent pretty-printing the output. Non-integer solutions are displayed to 15 digits of accuracy.
As every sequence of n real numbers can be generated by a polynomial of order no more than n-1, the "function does not exist" case is not handled.
Sample usage:
$ echo 1 11 41 79 | python find-poly.py
-2x^3 +22x^2 -42x +23

$ echo 1 11 35 79 | python find-poly.py
x^3 +x^2 -1

$ echo 12 38 78 | python find-poly.py
7x^2 +5x

$ echo 43 12 -5 19 57 | python find-poly.py
-2.25x^4 +27x^3 -98.75x^2 +110x +7

There was no restriction in using any specific library, so here is a solution in Python using Sympy
Python 2.x: 71 Characters
from sympy import*
print interpolate(map(int,raw_input().split()),abc.x)

That is quite nice, althought I did need to explicitly import sympy.abc to get it to work.