text:
Numeronyms or N8s?
A numeronym (also known as a "numerical contraction") is when a word is shortened using numbers. A common contraction method is to use the length of the replaced substring to replace all but the first and last characters. For example, use i18n instead of internationalization, or L10n instead of localization. (The L is capitalized since a lowercase one looks too similar to the 1.)
Of course, several words in the same phrase may have the same abbreviated form, so your job is to convert a group of words to their numeronyms, or in the event that there exists some different words with the same numeronym, your program should give a result of A7s R4t, short for Ambiguous Result (yes, I know that this result is itself an ambiguous result.)
Rules:

Use a program or function, and print or return the result.
Input is taken as a single string.
The output is a single string of space-delimited words.
Your program need not convert words with length 3, and should not convert shorter words.
If an l (lowercase ell) would occur before a 1 (one), it should be made uppercase.
If an I (uppercase eye) would occur before a 1 (one), it should be made lowercase.
Input will be printable ASCII and spaces. Words are separated by spaces.
Shortest code wins.

Examples:
A7s R4t -> A7s R4t (OR: A1s R1t, etc)
Ambiguous Result -> A7s R4t
Billy goats gruff -> B3y g3s g3f
Thanks for the Memories -> T4s f1r the M6s (one possible answer, NOT: Thnks fr th Mmrs)
Programming Puzzles & Code Golf -> P9g P5s & C2e G2f
globalization -> g11n
localizability -> L12y
Internationalization or antidisestablishmentarianism -> i18n or a26m
Internationalization or InternXXXXXalization -> A7s R4t
what is this fiddle and faddle -> A7s R4t
A be see -> A be s1e (OR: A be see)
see sea -> s1e s1a (OR: see sea)
2B or not 2B -> 2B or not 2B (OR: 2B or n1t 2B. 2 letters, don't change, don't count as ambiguous)
this example is this example -> t2s e5e is t2s e5e (same words aren't ambiguous)
l1 -> l1 (2 letters, don't change.)
I1 -> I1 (2 letters, don't change.)

Edit: If anyone didn't get the reference: Thnks fr th Mmrs

Can the input contain numbers as well? If so, does an input of l1 become L1 or stay as l1?

I presume from the emphasis on different that example example would be e5e e5e, but it would be good to include a test case which covers this.

Added test cases for both of your questions (2B or not 2B and after.)

J, 92 bytes
(' 'joinstring(<&(]`(rplc&('I1';'i1')&(rplc&('l1';'L1'))&({.,([:":#-2:),{:))@.(#>3:))&>&;:))

A looong chain of composed calls.
The first part is just a fork: a literal, joinstring, and a function (in J, 1 (10 + +) 2 is (10 + (1 + 2))).
The second part is the function. The two rplc calls are to replace the I/l when they could be confused.
& is composition, and composing an operator with a value curries. (so 3&+ gives a function that expects the 2nd argument to be added).
Finally, the last part is the function that takes the first, the length-2 (composed with stringification), and the last.
the &>&;: bit at the end composes this function (which should be applied to every argument) to > (unboxing), because ;: (split words) returns a boxed list (so that every element can have different length).
example:
     (' 'joinstring(<&(]`(rplc&('I1';'i1')&(rplc&('l1';'L1'))&({.,([:":#-2:),{:))@.(#>3:))&>&;:)) 'hey you baby Iooooooooneey I1'
hey you b2y i11y I1

Caché ObjectScript, 231 bytes
r(a,b) s o=$REPLACE(o,a,b) q
z(s) f i=1:1:$L(s," ") s u=$P(s," ",i),l=$L(u),o=$S(l<4:u,1:$E(u)_(l-2)_$E(u,l)) d:l>3 r("I1","i1"),r("l1","L1") d  g:r z+4
    . i '(l<4!(v(o)=u!'$D(v(o)))) s r=1 q
    . s v(o)=u,t=t_o_" "
    q t
    q "A7s R4t"

This would be good-ol' standards-compliant MUMPS if it weren't for that pesky $REPLACE call, which isn't part of the standard. Reimplementing it in pure M takes a good 80ish bytes, so I didn't go down that route.
The entry point is $$z("your string here"), which returns "y2r s4g h2e", and so forth.

Could you perhaps link to the language? I haven't heard of it.

I mean, it's the thing that comes up when you google for it (http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?KEY=TCOS) - a proprietary flavor of MUMPS.

C#, 280 274 bytes
First time golfer here! Been enjoying reading these lately and so I thought I might try out some myself! Probably not the best solution, but oh well!
class B{static void Main(string[] a){string[] n=Console.ReadLine().Split(' ');string o="";int j,i=j=0;for(;j<n.Length;j++){int s=n[j].Length;n[j]=((s<4)?n[j]:""+n[j][0]+(s-2)+n[j][s-1])+" ";o+=n[j];for(;i<j;i++)if(n[j]==n[i]){o="A7s R4t";j=n.Length;}}Console.WriteLine(o);}}

Same thing ungolfed:
class B
{
    static void Main(string[] a)
    {
        string[] n = Console.ReadLine().Split(' ');
        string o = "";
        int j, i = j = 0;
        for(; j < n.Length;j++)
        {
            int s = n[j].Length;

            n[j] = ((s<4) ? n[j] : "" + n[j][0] + (s - 2) + n[j][s - 1]) + " ";
            o += n[j];
            for (; i < j; i++)
            {
                if (n[j] == n[i]) { o = "A7s R4t"; j=n.Length;}
            }
        }
        Console.WriteLine(o);
    }
}

Thanks guys!

Welcome to PPCG! c:

Perl, 131 120 bytes
I've added a byte for using the -p switch:
s/\B(\w+)(\w)/length($1)."$2_$1"/ge;$_="A7s R4t\n"if/(\w\d+\w)(\w+)\b.*\1(?!\2)/;s/_\w+//g;s/I1\w/\l$&/g;s/l1\w/\u$&/g;

Explanation
# Replace internal letters with count, but keep them around for the next test.
s/\B(\w+)(\w)/length($1)."$2_$1"/ge;
# Detect ambiguous result
$_ = "A7s R4t\n" if
    # Use negative look-ahead assertion to find conflicts
    /(\w\d+\w)(\w+)\b.*\1(?!\2)/;
# We're done with the internal letters now
s/_\w+//g;
# Transform case of initial 'I' and 'l', but only before '1'
s/I1\w/\l$&/g;
s/l1\w/\u$&/g;

Not sure whether is correct but I expected the “l” in “like” to not get capitalized when transformed into “l2e”, as is not followed by “1”.

Tested just a couple of cases, but seem to work: s/(\w)(\w+)(\w)/$1.length($2)."$3_$2"/ge → s/\B(\w+)(\w)/length($1)."$2_$1"/ge.

Thanks, @manatwork.  I overlooked the requirement to caseswap [Il] only before 1 - saved a couple of bytes, too!

JavaScript (ES6), 165 bytes
s=>(r=s.replace(/\S+/g,w=>(m=w.length-2)<2?w:(i=d.indexOf(n=((m+s)[0]<2&&{I:"i",l:"L"}[w[0]]||w[0])+m+w[m+1]))>=0&d[i+1]!=w?v=0:d.push(n,w)&&n,v=d=[]),v?r:"A7s R4t")

Explanation
s=>(                         // s = input string
  r=s.replace(               // r = result of s with words replaced by numeronyms
    /\S+/g,                  // match each word
    w=>                      // w = matched word
      (m=w.length-2)         // m = number of characters in the middle of the word
        <2?w:                // if the word length is less than 4 leave it as it is
      (i=d.indexOf(          // check if this numeronym has been used before
        n=                   // n = numeronymified word
          ((m+s)[0]<2&&      // if the number starts with 1 we may need to replace
            {I:"i",l:"L"}    //     the first character with one of these
              [w[0]]||w[0])+ // return the replaced or original character
          m+w[m+1]
      ))>=0&d[i+1]!=w?       // set result as invalid if the same numeronym has been
        v=0:                 //     used before with a different word
      d.push(n,w)&&n,        // if everything is fine return n and add it to the list
    v=                       // v = true if result is valid
      d=[]                   // d = array of numeronyms used followed by their original word
  ),
  v?r:"A7s R4t"              // return the result
)

Test

<input type="text" id="input" value="lnternationalization or antidisestablishmentarianism" />
<button onclick='result.textContent=(

s=>(r=s.replace(/\S+/g,w=>(m=w.length-2)<2?w:(i=d.indexOf(n=((m+s)[0]<2&&{I:"i",l:"L"}[w[0]]||w[0])+m+w[m+1]))>=0&d[i+1]!=w?v=0:d.push(n,w)&&n,v=d=[]),v?r:"A7s R4t")

)(input.value)'>Go</button>

JavaScript ES6, 162
w=>(v=(w=w.split` `).map(x=>(l=x.length-2+'')>1?((l[0]>1||{I:'i',l:'L'})[x[0]]||x[0])+l+x[-~l]:x)).some((a,i)=>v.some((b,j)=>a==b&w[i]!=w[j]))?'A7s R4t':v.join` `

Less golfed
// Less golfed
f=w=>{
  w = w.split` ` // original text splitted in words
  v = w.map(x=> { // build modified words in array v

    l = x.length - 2 // word length - 2
    if (l > 1) // if word length is 4 or more
    {
      a = x[0] // get first char of word
      l = l+'' // convert to string to get the first digit
      m = l[0] > 1 || {I:'i', l:'L'} // only if first digit is 1, prepare to remap I to i and l to L
      a = m[a] || a // remap
      return a + l + x[-~l] // note: -~ convert back to number and add 1
    }
    else
      return x // word unchanged
  })
  return v.some((a,i)=>v.some((b,j)=>a==b&w[i]!=w[j])) // look for equals Numeronyms on different words
  ? 'A7s R4t'
  : v.join` `
}

Test

F=w=>(v=(w=w.split` `).map(x=>(l=x.length-2+'')>1?((l[0]>1||{I:'i',l:'L'})[x[0]]||x[0])+l+x[-~l]:x)).some((a,i)=>v.some((b,j)=>a==b&w[i]!=w[j]))?'A7s R4t':v.join` `

console.log=x=>O.innerHTML+=x+'\n'

;['A7s R4t','Ambiguous Result','Billy goats gruff','Thanks for the Memories',
'Programming Puzzles & Code Golf','globalization','localizability',
'Internationalization or antidisestablishmentarianism',
'Internationalization or InternXXXXXalization','what is this fiddle and faddle',
'A be see','see sea','2B or not 2B','this example is this example','l1','I1']
.forEach(t=>console.log(t+' -> '+F(t)))

Python 2, 185 bytes
d={}
r=''
for w in input().split():
 l=len(w);x=(w[0]+`l-2`+w[-1]).replace('l1','L1').replace('I1','i1')
 if l<4:x=w
 if d.get(x,w)!=w:r='A7s R4t';break
 d[x]=w;r+=x+' '
print r.strip()

Factor, 48 35 bytes, noncompeting
It's a lambda that goes on the stack, that doesn't technically meet the really annoyingly hard requirements that I originally managed to overlook.
[ " " split [ a10n ] map " " join ]

Uses the english vocabulary.
Or, if we inline the a10n library word, then 131 bytes (with auto-imports):
: a ( b -- c ) " " split [ dup length 3 > [ [ 1 head ] [ length 2 - number>string ] [ 1 tail* ] tri 3append ] when ] map " " join ;

Does this handle the i/L stuff and A7s R4t?

@RobertFraser I'm certain it does, though I'm not at a Factor compiler this minute; I'll add passing unit tests when I am. :D

Yeah, sorry about the requirements. A week after I finished the question, I was like "oh no, what have I done," but it was too late. I might make a simpler version as a separate challenge.

Python 3, 160
I'd love to find a good way to replace those replace calls.
def f(a):y=[(x,(x[0]+str(len(x)-2)+x[-1]).replace('l1','L1').replace('I1','i1'))[len(x)>3]for x in a.split()];return('A7s R4t',' '.join(y))[len(set(y))==len(y)]

With some test cases:
assert f('Billy goats gruff') == 'B3y g3s g3f'
assert f('Programming Puzzles & Code Golf') == 'P9g P5s & C2e G2f'
assert f('Internationalization or InternXXXXXalization') == 'A7s R4t'


text:
Calculate the average and standard deviation, rubiks cube style
Introduction
When solving a rubiks cube, one often write down the times like this
11.91, (11.28), (12.32)

This is called a average of 3, while a average of 5 looks like this
13.36, (11.89), 12.31, (16.44), 12.26

Note how the worst and best times have parenthesis around them. When calculating the average of 5 these times are removed. For an average of 3 the worst and best times are NOT removed. Similarly when calculating the standard deviation.
When taking the average of more than 12 cubes things start to get a bit harder. The general rule of thumb is:
When solving fewer than 5 cubes, do not remove any times when calculating avg or std
When evaluating fewer than 12 times, remove the best and worst time when calculating avg or std
When evaluating fewer than 40 times remove the 1/12 worst and 1/12 best times rounded down the nearest integer.
When evaluating more than 40 times remove the 1/20 worst times and the 1/20 best times rounded down to the nearest integer.
For an average of 100 this would mean we would remove the (100/20) = 5 best solves and (100/20) = 5 worst solves. Giving
14.88, 12.28, 13.76, 16.06, 13.82, 13.26, 14.57, 12.56, 15.02, 14.73,
13.87, 14.59, 15.17, (18.48), 12.09, 12.76, 11.65, 14.14, 12.83, 14.30,
13.28, 14.02, 12.55, 15.18, 13.65, 12.72, 14.86, 14.08, 15.07, 12.88, 13.78,
13.88, 14.63, 12.72, (10.10), 14.70, 12.82, 13.27, 13.82, 14.74, (11.22),
13.46, 12.66, 14.06, (10.58), 15.06, (18.27), 13.39, (17.88), (18.67),
15.38, 15.60, 14.24, 12.64, 15.51, 14.23, 16.71, 14.55, 14.32, 12.33, 11.90,
13.65, 13.69, 13.90, 13.15, (9.61), 12.91, 13.39, 11.77, 12.64, 15.22,
14.69, 12.76, 15.10, 11.91, (11.28), 12.32, 14.28, 14.46, 14.66, 14.15,
15.27, (17.73), 12.70, 14.58, 11.84, 13.25, 13.36, 13.26, 15.72, 14.15,
12.77, 15.26, 12.87, 12.96, 13.57, 14.50, 14.30, 14.57, 12.69

The challenge
The problem at hand is to take a (large) list of numbers and figure out the best average or std of a subset of these.
input
list, n, avg or std

Write a program that takes in a list of numbers formated exactly as comma seperated numbers 12.91, 13.39, ... or [12.91, 13,39 ... ] You can assume that the list only contains real valued positive numbers less than 2^32.
A number n indicating how many numbers to average or take the std of, if n=0 one should take the average / std of all the numbers.
A string avg or std indicating if one should return the lowest average of n numbers or the lowest standard deviation (std). A negative n or a non integer should throw an error, blank or return false.
Output
The output should be exactly on the form
avg = ...
list of of numbers

or
std = ...
list of of numbers

As shown in the examples. Note that the best and worst times are marked with brackets as given by the rules above. The function should return the n consecutive times with the lowest avg or std At every 12 time, a newline should be inserted.
Test case
I will use the following list of 200 numbers to base my tests on
15.86, 17.02, 24.01, 21.01, 15.93, 14.86, 18.43, 12.52, 18.48, 19.85, 13.01, 14.92, 13.07, 13.44, 13.07, 15.08, 12.70, 13.59, 15.22, 11.88, 13.26, 13.62, 12.85, 16.88, 15.78, 15.94, 14.88, 12.28, 13.76, 16.06, 13.82, 13.26, 14.57, 12.56, 15.02, 14.73, 13.87, 14.59, 15.17, 18.48, 12.09, 12.76, 11.65, 14.14, 12.83, 14.30, 13.28, 14.02, 12.55, 15.18, 13.65, 12.72, 14.86, 14.08, 15.07, 12.88, 13.78, 13.88, 14.63, 12.72, 10.10, 14.70, 12.82, 13.27, 13.82, 14.74, 11.22, 13.46, 12.66, 14.06, 10.58, 15.06, 18.27, 13.39, 17.88, 18.67, 15.38, 15.60, 14.24, 12.64, 15.51, 14.23, 16.71, 14.55, 14.32, 12.33, 11.90, 13.65, 13.69, 13.90, 13.15, 9.61, 12.91, 13.39, 11.77, 12.64, 15.22, 14.69, 12.76, 15.10, 11.91, 11.28, 12.32, 14.28, 14.46, 14.66, 14.15, 15.27, 17.73, 12.70, 14.58, 11.84, 13.25, 13.36, 13.26, 15.72, 14.15, 12.77, 15.26, 12.87, 12.96, 13.57, 14.50, 14.30, 14.57, 12.69, 15.21, 14.45, 14.90, 14.91, 15.66, 15.87, 14.79, 15.69, 17.37, 15.42, 12.11, 14.89, 13.39, 12.62, 13.42, 14.07, 14.85, 13.23, 14.05, 14.43, 13.36, 14.19, 14.16, 14.66, 12.02, 12.56, 12.69, 12.55, 14.36, 15.79, 12.53, 12.51, 12.15, 15.60, 13.42, 12.87, 13.02, 15.66, 13.18, 14.77, 13.57, 13.86, 12.26, 14.48, 14.68, 11.85, 14.82, 13.74, 13.85, 15.05, 14.78, 14.43, 12.72, 14.39, 15.06, 15.28, 12.06, 14.59, 15.49, 11.66, 14.83, 14.09, 11.62, 15.96, 14.77, 14.99, 14.20, 12.35, 17.62, 11.66, 13.46, 15.24, 14.85, 13.48

Input 0:
list, 3, avg

Output 0:
avg = 11.84
11.91, (11.28), (12.32)

Input 1:
list, 12, avg

Output 1:
avg = 12.88
(9.61), 12.91, 13.39, 11.77, 12.64, (15.22), 14.69, 12.76, 15.10, 11.91, 11.28, 12.32

Input 2:
list, 12, std

Output 2:
std = 0.44
15.21, 14.45, 14.90, 14.91, 15.66, 15.87, 14.79, 15.69, (17.37), 15.42, (12.11), 14.89

Input 3:
list, 0, std

Output 3:
std = 1.21
15.86, 17.02, (24.01), (21.01), 15.93, 14.86, (18.43), 12.52, (18.48), (19.85), 13.01, 14.92,
13.07, 13.44, 13.07, 15.08, 12.70, 13.59, 15.22, 11.88, 13.26, 13.62, 12.85, 16.88,
15.78, 15.94, 14.88, 12.28, 13.76, 16.06, 13.82, 13.26, 14.57, 12.56, 15.02, 14.73,
13.87, 14.59, 15.17, (18.48), 12.09, 12.76, (11.65), 14.14, 12.83, 14.30, 13.28, 14.02,
12.55, 15.18, 13.65, 12.72, 14.86, 14.08, 15.07, 12.88, 13.78, 13.88, 14.63, 12.72,
(10.10), 14.70, 12.82, 13.27, 13.82, 14.74, (11.22), 13.46, 12.66, 14.06, (10.58), 15.06,
(18.27), 13.39, (17.88), (18.67), 15.38, 15.60, 14.24, 12.64, 15.51, 14.23, 16.71, 14.55,
14.32, 12.33, 11.90, 13.65, 13.69, 13.90, 13.15, (9.61), 12.91, 13.39, (11.77), 12.64,
15.22, 14.69, 12.76, 15.10, 11.91, (11.28), 12.32, 14.28, 14.46, 14.66, 14.15, 15.27,
(17.73), 12.70, 14.58, 11.84, 13.25, 13.36, 13.26, 15.72, 14.15, 12.77, 15.26, 12.87,
12.96, 13.57, 14.50, 14.30, 14.57, 12.69, 15.21, 14.45, 14.90, 14.91, 15.66, 15.87,
14.79, 15.69, 17.37, 15.42, 12.11, 14.89, 13.39, 12.62, 13.42, 14.07, 14.85, 13.23,
14.05, 14.43, 13.36, 14.19, 14.16, 14.66, 12.02, 12.56, 12.69, 12.55, 14.36, 15.79,
12.53, 12.51, 12.15, 15.60, 13.42, 12.87, 13.02, 15.66, 13.18, 14.77, 13.57, 13.86,
12.26, 14.48, 14.68, 11.85, 14.82, 13.74, 13.85, 15.05, 14.78, 14.43, 12.72, 14.39,
15.06, 15.28, 12.06, 14.59, 15.49, (11.66), 14.83, 14.09, (11.62), 15.96, 14.77, 14.99,
14.20, 12.35, 17.62, (11.66), 13.46, 15.24, 14.85, 13.48

Split the lines at every 12 number.
Input 4:
list, 201, avg

Output 5:
Throw `Error` or `False`.

Input 6:
list, 1, avg

Output 6:
avg = 9.61
(9.61)

Input 8:
list, 1, std

Output 8:
std = 0
(15.86)

just return the first element of the list.
Scoring
Submissions will be scored in bytes. I recommend this website to keep track of your byte count, though you can use any counter you like. Like always whitespace counts as bytes.
Remove 25% of your byte count if your function has the ability to switch between highest avg and std, and lowest avg and std. Eg input on the form
list, n, avg / std, high / low

This is code-golf, so the lowest score wins!

Can a function be written?

yeah =) No problem

This is an old post, but I have some questions. Why is output 0 not 10.10? (The 3 lowest values in your example list are [9.61, 10.10, 10.58].) Why are multiple values in parentheses in output 3? (The description just says that those are the "smallest" and "largest", but that's not the case.) Finally, why is output 8 zero? The standard deviation of only 1 number is undefined (because it involves division by zero). I think I have a neat solution to this puzzle, but I'm not sure because the details are so vague...

Java 10, 944 903 861 bytes
import java.util.*;interface M{static void main(String[]a){var f=a[2];int n=new Short(a[1]),i=0,l,j,k;if(n<0)return;List<Double>L=new Stack(),t,r,R=L,u,U=L,S=L,V=L;for(var s:a[0].split(","))L.add(new Double(s));l=L.size();n=n<1?l:n;i=0;double m=99,M=m,q,Q,x,y,z;do{for(t=new Stack(),x=y=j=0;j<n;)t.add(L.get(i+j++));for(k=n<12?0:n<40?n/12:n/20,j=k=k<1?1:k,u=new ArrayList(t),r=new Stack();j-->0;){r.add(q=Collections.min(t));r.add(Q=Collections.max(t));if(n>4){t.remove(q);t.remove(Q);}}for(var T:t)x+=T;x/=k=n>4?n-2*k:n;if(x<m){m=x;R=r;U=u;}for(var T:t)y+=(z=T-x)*z;y=Math.sqrt(y/k);if(y<M){M=y;S=r;V=u;}}while(i++<l-n);j=f.charAt(0)-97;System.out.println(f+" = "+f.format(f="%.2f",q=j<1?n<2?Collections.min(L):m:n<2?0:M));i=0;for(var o:j<1?U:n<2?L.subList(0,1):V)System.out.print(f.format((j<1?R:S).remove(o)?"(%.2f)":f,n+j<2?q:o)+(++i<n&i%12>0?", ":"\n"));}}

Full program requirement, strict I/O formatting, validating.. sigh.. >.>
Verify all test cases: 3,avg ; 12,avg ; 12,std ; 0,std ; 201,avg ; 1,avg ; 1,std ; -1,either.
Here is the same as function with somewhat flexible I/O and without validating (still 776 739 719 705 bytes..):
import java.util.*;(L,n,f)->{int i=0,l=L.size(),j,k;List<Double>t,r,R=new Stack(),u,U=R,S=R,V=R;n=n<1?l:n;double m=99,M=m,q,Q,x,y,z;do{for(t=new Stack(),x=y=j=0;j<n;)t.add(L.get(i+j++));for(k=n<12?0:n<40?n/12:n/20,j=k=k<1?1:k,u=new ArrayList(t),r=new Stack();j-->0;){r.add(q=Collections.min(t));r.add(Q=Collections.max(t));if(n>4){t.remove(q);t.remove(Q);}}for(var T:t)x+=T;x/=k=n>4?n-2*k:n;if(x<m){m=x;R=r;U=u;}for(var T:t)y+=(z=T-x)*z;y=Math.sqrt(y/k);if(y<M){M=y;S=r;V=u;}}while(i++<l-n);j=f.charAt(0)-97;System.out.println(f+" = "+f.format(f="%.2f",q=j<1?n<2?Collections.min(L):m:n<2?0:M));for(var o:j<1?U:n<2?L.subList(0,1):V)System.out.print(f.format((j<1?R:S).remove(o)?"(%.2f)":f,n+j<2?q:o)+" ");}

-20 bytes thanks to @ceilingcat.
Try it online.
Explanation:
import java.util.*;           // Required import for List, Stack and Collections
interface M{                  //  Class
  static void main(String[]a){//   Mandatory main-method
    var f=a[2];               //    Save the third argument in String `f`
    int n=new Short(a[1]),    //    Save the second argument as integer in `n`
        i=0,l,j,k;            //    Some temp/index integers
    if(n<0)return;            //    If `n` is negative: stop the program
    List<Double>L=new Stack(),//    Input-List, starting empty
                t,r,R=L,u,U=L,S=L,V=L;
                              //    Some temp Lists
    for(var s:a[0].split(","))//    Loop over the input-items as Strings
      L.add(new Double(s));   //     Convert them to doubles, and add them to the List
    l=L.size();               //    Set `l` to the amount of items
    n=n<1?l:n;                //    If `n` was 0, make it equal to `l` instead
    double m=99,M=m,          //    Lowest `avg` and `std`, both starting at 99
           q,Q,x,y,z;         //    Some temp floats
    do{                       //    Start the do-while:
      for(t=new Stack(),      //     Reset List `t`
          x=y=j=0;j<n;)       //     Loop `j` in the range [0, `n`):
        t.add(L.get(i+j++));  //      And add the items on index `i+j` of List `L` to `t`
      for(k=n<12?             //     If `n` is smaller than 12
             0                //      Set `k` to 0
            :n<40?            //     Else-if `n` is in the range [12; 40)
             n/12             //      Set `k` to 1/12th of `n`
            :                 //     Else (`n` is 40 or larger)
             n/20,            //      Set `k` to 1/20th of `n`
          j=k=k<1?1:k,        //     If `k` is 0 due to rounding, make it 1 instead
          u=new ArrayList(t), //     Copy List `t` to `u`
          r=new Stack();      //     And reset List `r`
          j-->0;){            //     Loop `k` amount of times:
        r.add(q=Collections.min(t));
                              //      Add the smallest item in List `t` to `r`
        r.add(Q=Collections.max(t));
                              //      as well as the largest item
        if(n>4){              //      If `n` is 5 or larger:
          t.remove(q);t.remove(Q);}}
                              //       Remove those two items from List `t`
      for(var T:t)            //     Loop over List `t`:
        x+=T;                 //      And sum them all into value `x`
      x/=k=n>4?               //     If `n` is 5 or larger
          n-2*k               //      Set `k` to `n-2*k` and divide `x` by that
         :                    //     Else:
          n;                  //      Set `k` to `n` and divide `x` by that
      if(x<m){                //     If `x` is smaller than the previous smallest avg `m`
        m=x;                  //      Replace `m` with `x` (smallest avg)
        R=r;                  //      Replace `R` with `r` (items between parenthesis)
        U=u;}                 //      And replace `U` with `u` (all `n` items in this avg)
      for(var T:t)            //     Loop over List `t` again:
        y+=(z=T-x)*z;         //      And sum `(T-x)**2` to `y`
      y=Math.sqrt(y/k);       //     Also divide `y` by `k`, and take its square-root
                              //     The process above is how you calculate the std
      if(y<M){                //     If `y` is smaller than the previous smallest std `M`:
        M=y;                  //      Replace `M` with `y` (smallest std)
        S=r;                  //      Replace `S` with `r` (items between parenthesis)
        V=u;}}                //      And replace `V` with `u` (all `n` items in this std)
    while(i++<l-n);           //    Continue the do-while as long as `i` is smaller than `l-n`
    j=f.charAt(0)-97;         //    Set `j` to the alphabetic index of the first letter of `f`
    System.out.println(f+" = "//    Print "`f` = "
      +f.format(f="%.2f",     //     Round to two decimals
        q=j<1?                //     If it's an avg:
           n<2?               //      And `n` is 1:
            Collections.min(L)//       Simply take the smallest value in `L`
           :                  //      Else:
            m                 //       Take the calculated lowest avg `m`
          :                   //     Else (it's an std):
           n<2?               //      If `n` is 1:
            0                 //       Use 0
           :                  //      Else:
            M));              //       Take the calculated lowest std `M`
    i=0;                      //    Reset `i` to 0
    for(var o:j<1?            //    If it's an avg:
               U              //     Loop over List `U`
              :               //    Else (it's an std instead):
               n<2?           //     If `n` is 1:
                L.subList(0,1)//      Only take the first item of List `L`
               :              //     Else:
                V)            //      Loop over List `V`
      System.out.print(f.format(
       (j<1?                   //    If it's an avg:
         R                     //     Use List `R`
        :                      //    Else (it's an std instead):
         S)                    //     Use List `S`
           .remove(o)?         //    If the current item is in this List:
             "(%.2f)"          //     Round to two decimals, and add parenthesis
            :                  //    Else:
             f,                //     Only round to two decimals
       n+j<2?                  //    If it's an avg, and `n` is 1:
        q                      //     Take the smallest value in `L`
       :                       //    Else:
        o)                     //     Take the current item in this loop
          +(++i<n              //    If it's not the last item,
                 &i%12>0?      //    and also not the 12th item of the row:
            ", "               //     Append a comma and space as separator
           :                   //    Else:
            "\n"));}}          //     Append a newline instead

05AB1E, score: 85.5 (114 bytes - 25% bonus)
† Could be score: 83.25 (111 bytes - 25% bonus) by removing 2.ò (which rounds the output avg/std to 2 decimals). This isn't mentioned in the challenge rules, but since everything else about the I/O is so strict and rounding to two decimals is also done by the WCA (World Cube Association), I've just included it.
DŒsgI‚²ĀèDUùεƵJü2XŽ4Ý2ô@ÏXšzX*òθFDWsà‚vyD…(ÿ).;}}Dʒ'(å≠X5‹~}žuмDÅA©-nÅAt®‚³Çθè‚}Σθ}|θÇнƵ7.Sè`2.ò³'=‚sªs12ô»»¹gÝ²å×

Also supports low vs high as fourth input. At the cost of just 8 bytes (|θÇнƵ7.Sè instead of н), this was well worth the 25% bonus.
Outputs an empty string for invalid \$n\$.
Try it online or verify all test cases.
Explanation:
D                    # Duplicate the first (implicit) input-list
 Œ                   # Pop the copy, and get all its sublists
  sgI‚²Āè            # Transform n=0 to n=listLength
  s                  #  Swap so the first input-list is at the top again
   g                 #  Pop and push its length
    I‚               #  Pair it with the second input-integer `n`
      ²              #  Push the second input-integer `n` again
       Ā             #  Check whether it's NOT 0 (0 if 0; 1 otherwise)
        è            #  0-base index this into the pair
         DU          # Store a copy in variable `X`
           ù         # Only keep the subslist of that size
ε                    # Map over each sublist
 ƵJü2XŽ4Ý2ô@ÏXšzX*òθ #  Determine how many lowest/highest numbers we should surround
                     #  with parenthesis:
 ƵJ                  #   Push compressed integer 120
   ü2                #   Get its overlapping pairs: [12,20]
     X               #   Push value `X`
      Ž4Ý            #   Push compressed integer 1240
         2ô          #   Split it into pairs: [12,40]
           @         #   >= check on `X`: [X>=12,X>=40]
            Ï        #   Keep the [12,20]-values at the truthy indices
             Xš      #   Prepend `X` itself to this list
               z     #   Calculate 1/v for each value in this list
                X*   #   Multiply each by `X`
                  ò  #   Round each to the nearest integer
                   θ #   Pop and keep the last one
 F                   #  Loop that many times:
  D                  #   Duplicate the current sublist
   W                 #   Push its minimum (without popping)
                     #   (will ignore values already wrapped in parenthesis)
    s                #   Swap so the copy of the sublist is at the top again
     à               #   Pop and push its maximum
                     #   (will ignore values already wrapped in parenthesis)
      ‚              #   Pair this minimum and maximum together
       v             #   Loop over this pair:
        yD           #    Push the min or max twice
          …(ÿ)       #    Surround the top copy in parenthesis
              .;     #    Replace the first occurrence of this value in the sublist
       }             #   Close the [min,max]-loop
 }                   #  Close the other loop
  D                  #  Duplicate the modified sublist
   ʒ                 #  Filter the copy by:
    '(å≠            '#   Check that the current value does NOT contain parenthesis
           ~         #   OR
        X5‹          #   Whether `X` is smaller than 5
   }                 #  Close the filter
    žu               #  Push constant string "()<>[]{}"
      м              #  Remove all those characters from each value within the list
                     #  (only applies if `X` is smaller than 5)
  DÅA©-nÅAt®‚        #  Pop this list, and push its [std,avg] pair:
  D                  #   Duplicate this list
   ÅA                #   Pop the copy, and get its average
     ©               #   Store this average in variable `®` (without popping)
      -              #   Subtract this average from each value in the list
       n             #   Square each
        ÅA           #   Take the average of this list again
          t          #   Take the square-root of that
           ®‚        #   And pair this std with the average `®`
  ³                  #  Push the third input-string
   Ç                 #  Convert it to a list of codepoint integers
                     #  ("avg"=[97,118,103]; "std"=[115,116,100])
    θ                #  Pop and push the last value ("avg"=103; "std"=100)
     è               #  Use that to 0-based modular index into the pair of [std,avg]
      ‚              #  And pair it together with the modified list
}                    # Close the map
 Σ                   # Sort this list by:
  θ                  #  The last item of the pair (the avg or std)
 }                   # Close the sort-by
  |                  # Get a list of all remaining inputs: [third,fourth]
   θ                 # Pop and keep its last item (the fourth input)
                     # (`|θ` cannot be `I`, since `³` won't add the third input to the
                     # input history)
    Ç                # Convert it to a list of codepoint integers as well
                     # ("low"=[108,111,119]; "high"=[104,105,103,104])
     н               # Pop and push the first value ("low"=108; "high"=104)
      Ƶ7             # Push compressed integer 108
        .S           # Compare: -1 if <108; 0 if ==108; 1 if >108
                     # (aka "low"=0; "high"=-1)
          è          # Use that to 0-based modular index into the sorted list
                     # (where -1 will take the last/highest item)
`                    # Pop the pair and push its contents to the stack
 2.ò                 # Round the avg/std to 2 decimals†
    ³                # Push the third input-string again
     '=‚            '# Pair it with an "="
        sª           # Swap and append the rounded avg/std
 s                   # Swap so the list is at the top
  12ô                # Split it into parts of size 12
     »               # Join each inner list by spaces, and then each string by newlines
          »          # Join the two strings on the stack with newline delimiter
¹gÝ²å×               # Transform it to an empty string if `n` is invalid:
¹g                   #  Push the length of the first input-list
  Ý                  #  Pop and push a list in the range [0,listLength]
   ²å                #  Check if the second input `n` is in this list
                     #  (1 if truthy; 0 if falsey)
     ×               #  Repeat the string that many times
                     # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to compress large integers?) to understand why ƵJ is 120; Ž4Ý is 1240; and Ƶ7 is 108.

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:
Tips for golfing in Elixir
Elixir is a relatively new functional language, which I've taken a deep interest in. I'd like to get general tips about golfing in Elixir and learn techniques that can be applied to code-golf problems that are somewhat specific to Elixir in general.

Based on so many similar questions about Python, Ruby, Javascript, etc. I'll also try to post tips as I learn more about the language.

What does Elixir running on the Erlang VM have to do with the Erlang language?

Don't use the Pipe operator or parenthesis for calling methods
# With Pipe
arg |> M.a |> M.b |> M.c   # 24 Bytes
arg|>M.a|>M.b|>M.c         # 18 Bytes

# With Parenthesis
M.c(M.b(M.a(arg)))         # 18 Bytes

# Only Spaces
M.c M.b M.a arg            # 15 Bytes

String and char arguments don't need spaces
For example, IO.puts"Hello, World!" and IO.puts'cat' are valid programs.

Inject code into strings
Instead of concatenating something into a string, like:
"prefix"<>code<>"suffix"

You can use #{} to insert it into the string:
"prefix#{code}suffix"

This will save 3 bytes.

Avoid arrow functions where possible
...and use the &<func>(&1,&2...) notation. For example:
each 0..25,fn x->IO.puts slice(concat(a,a),x,26) # 48 bytes
each 0..25,&IO.puts slice(concat(a,a),&1,26)     # 44 bytes

Map Arguments don't need spaces either
Like LegionMammal978's answer, you can leave out space when passing Map as an argument to a method:
IO.inspect%{a: 1,b: 2}

Can you similarly remove the spaces after the colons?

Sadly, no. But you can remove spaces after semicolons and commas.

use Bitwise
Say you want to import the module Bitwise, usually you would do:
import Bitwise

But there may be an alternative that works in some versions of Elixir:
use Bitwise

to save 3 bytes!
Even better if your only using a bit wise operator once, you can do:
Bitwise.&&&()

&&& being one of the many bitwise operators useable.

If you only need one bitwise op you can use Bitwise.&&&() or whatever too

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


text:
Find that zipcode!
Italian zipcodes are 5-digit numbers. Each number is linked to a province. There are 4610 zipcodes and 110 provinces (as of 2015) in Italy.
Given the list of zipcodes and the related province (in this file - Gist here) write a function (any language would be fine) that, accepting in input an Italian zipcode, writes out the related province. For unknown zipcodes (for example '99999'), the result should be "XX" ('unknown zipcode').
This is code-golf, so the function with the shortest amount of bytes wins.
Rules: you can't use Internet resources, files (including the list of zipcodes-provinces of before, even if you can include the list, but then that would count as chars in your source file), built-ins or libraries/modules that provide a mapping from zipcodes to provinces or any other external entity in your function.
Some test cases:

f("00185")="RM"
f("00014")="XX"
f("86071")="IS"
f("20020")="MI"
f("08010") can be "OR" or "NU" (they share the same zipcode)

Happy coding!

@mınxomaτ: done.

@mınxomaτ: I don't know if chars=1 byte in every programming language.

@mınxomaτ: ok, changed to "shortest amount of bytes".

Mathematica, 2973 bytes
Uncompress@"1:eJzt3U3O47gRgOEAWecQc5OR1f4cI7alkd1Go5e5QO6/y7ALBVIUJdMSRUru9ynoh8UiWfKmMX+YP/77v+7+57/++Y8fQ91VwrzZUZrw93PHgVYSC3cUypfLAQCQxvNhQp9jYeaHNeV6LnUyAADb1J3d8Mea6+dDVXYuR885TgEAYD++Og33fX7k6TnHKQAA7MflERel+3RtqxsAAMp7dH74OXcs77qyXM+lTgYAYJvak3+Nh50N12nWnR1W9qtC3disPz+VDVeGT39nDwAAtu8e0DxC4dfI098hT885TgEAYD9u3000nb6Z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RAIB9u1dLYny9ztgK/7SY0+0u8uaO532dm1vnFwUAIL/2px+h3Fho7fSa9D2n3hEAgH2rD2kj9tzz3UZ/NB3S83q/x7ukIwAAyqrvUzE1H5qbypmnvA+r3u15nd8CAIBPUv80Ic/YOvfNnZN3vfrV8/ubvxYAkMp/Oj/c3Hid5kp0nP/MXLraj1DunTDr9XLHOpJTl/Wc5uuW9AAA+PHj6bGZUFVcLnxCePb9fpet37K2Sht5eo6vHPYXn1vzGwAASOnRxkXpPl3b6gYAgPKqU1yU7tO1rW4AACivvgyjdE+vbL9DAADyOt6GUbqnV7bfIQAAedWPsZC5qYrwqhw9x1eGvmrN3gAAKOHeDaN0T69sv0MAAPLqTsMo3dMr2+8QAIDyrkcJ+/ZezF8X29+7XzLd2/zcvN8XAAAAAPCb+z/cceZL"~StringTake~{a=2FromDigits@#,a+1}&

Looking for a better way to compress this... Currently, it just uncompresses to this long string, and looks up the ZIP code in it.

This does not uncompress for me on Mathematica 10.2.0

@DavidCarraher Are you sure? It works on 10.1.0...

It returns this StringTake[  Uncompress[   "1:eJzt3U3O47gRgOEAWecQc5OR1f4cI7alkd1Go5e5QO6/\ y7ALBVIUJdMSRUru9ynoh8UiWfKmMX+YP/77v+7+57/\ ++Y8fQ91VwrzZUZrw93PHgVYSC3cUypfLAQCQxvNhQp9jYeaHNeV6LnUyAADb1J3d8Mea6\ +dDVXYuR885TgEAYD++Og33fX7k6TnHKQAA7MflERel+3RtqxsAAMp7dH74OXcs77qyXM+\ lTgYAYJvak3+Nh50N12nWnR1W9qtC3disPz+\ VDVeGT39nDwAAtu8e0DxC4dfI098hT885TgEAYD9u3000nb6Zd31zo67k3nTmrTn9qvz7r\ 3Gb09+5k408Pec4BQCA/air+vzr0qhMPO/Puzz7l85JyFji106/nnGa7lWYmnBd/\ Cluh7ZPmZnza4W+I80+AAAsEfxb642bj3nX8dh+MRFa28/Zfud/3bzcer8/A"...

@DavidCarraher Perhaps Compress functionality changed in 10.2?

MATLAB, 3987 2827 2813
Not sure it is worth posting this given the enormity of it, but anyway:
b=java.io.ByteArrayOutputStream;org.apache.commons.io.IOUtils.copy(java.util.zip.InflaterInputStream(java.io.ByteArrayInputStream(typecast(org.apache.commons.codec.binary.Base64.decodeBase64(uint8('eJxtV0mS4zgM/BIArjraHpfHMd5GdvvQN2r7/xMmAVIudcV0harLJEUsmUjA/ZWIGI+jgN9JoiwUXSIfJ+pSRzk7PBPlLlEujGegPATK7xdR1HeEPM3scU2kFApRfyYaO+xEypRZsOMp8ECj7n71xDJh11MU1pXLi7iDD+z00wv7i96bqVDE254zMeMN3X2cSILerXb1DrWiZydO5HikThKJDOQdU3KFxM0wn3C0w/9LvSUulBEbp5Ho/iIZJvXx+cRfOEEDTRQ97r39IidM9Z9mKBx2WFHLxfZc2ys0UrKVoh/1VA6fPfwgA4VnChJI7j12B0275sbOaj4KwytBbKJe4UxnN7zu5Oau2fAtHx53RYGHknmEp2oshEzSIltRC7s7eT+1bHYa++FGfkBMMqvzTig+31hRrJztJTg2MZPABr0PQK6inGhAFAPyEfGW5XF/pgAOIBAggT34hbOGBPKIk4J4GTEF54DGRAlIpADrAZ93LwrwVV/3lHjC8QXo4t7dhcKkmBQgmiWCEFg9HYEKt9Vhg+OWoxpNLOpxgMdEHXWNfQP8MH6er9jRjC74EexaXp4PSnHNFGOHGnM93uVmTf3N1zOlSf3wYDyxIjlrPi2bxTtsRHb/4xtf94hGsxWQK81rQp4i/IrIT3TKugQcYeu9o+wQhTPLhzve10zN4J5o9m0v4xmomPc4sWjGmF2N53Kgzo8bbEhZDZsZNhNsZtiEm3hwM2xbCVfv8WA/OOb9ibqosQZO4tec75/UjeoBKozDBolw6KkYhy3TlzsVrTPlDmKttnOzHa2e31SU/TKt2N/wzqI1VzFSv+eGBSpZqxFVJ4LYUeWacUEMgko3Rrz3NGgcFnFuGRbBklVLB10AHog2eKw1XQDpSUwbKjN9wM0B2Urq4QE3h1Wd3kcahq7pgUPNug0zJCES4M1YCq83jdz4VLOxv9CY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Vd+2bA3nKJfmjz0V64s6nj/MRfS0WZva4X63m6bnVDB/ylk5L1o1F7HJDNa90CP0YejBeH34KvQyuHEa80RRKdwmwCKVb1jNnFHPunh2xq1nObhXX6MKz6A4BffZ/be8qDOs15RD78wQn/fotqqM3dpqaqdFrVqsoOftbK3on7nrd+zJz0eoh9t6ic2J0A7+d71uGCeU49MjSON/E219TvCC8JNruM1t+Yt5ygZy/B5hg7258kzJ97rkeJvrS+XUBbIw7qLv/wLf0HznFGvw==')),'uint8'))),b);s=char(b.toByteArray)';
i=input('');h=@hex2dec;r=@reshape;t=cellfun(@(x){x(1:2),h(x(3:6)),h(r(x(7:end),2,[])')},strsplit(strtrim(regexprep(s,'([A-Z]{2,})',' $1'))),'Un',0);z='XX';for l=t
a=l{1};g=a{3};for g=r(a{3},2,[])
s=a{2}*10+g(1);e=s+g(2);if any(s:e==i);z=a{1};end
end
end;disp(z)

Yeah. Not really code golf material. Although much better now

After a bit of messing around, I managed to get MATLAB to directly access the Java Virtual Machine to be able to decompress a base64 encoded zip representation of the original data, which quite literally knocks 25% of the size of the code. I am being quite naughty here in that I don't block closing the InputStream and OutputStream during decompression, but who cares, it doesn't crash!.

After decompression, the zip codes are encoded in a format which is:
CCbbbboollooll...

Where CC is the two letter zip code. bbbb is a base (starting point) for this zip code which was divide by 10 and converted to hex so that only 4 characters are needed. For each base there is one or more ooll entries which is two hex numbers where oo is the offset from the base, and ll is the number of codes in the range minus 1.
All of the hex numbers are lower case, and all of the zip codes are upper case. This allows each entry to be separated based on whenever a two upper case letters appear (because the are only present as the first two letters in an entry).
Once each entry is split up, the hex numbers are parsed and converted into decimal, and we basically work through every entry to find a match.
The ranges for a given ooll pair are calculated as:
start = 10*dec(bbbb) + dec(oo)
end = start + dec(ll)

A new entry (CCbbbb) occurs at each point that the a new zip code appears. Some of the codes appear at more than one base address as there are some which are not all grouped together. Allowing multiple entries costs some bytes of CCbbbb headers, but it means that all of the lengths and ranges need only be 2 characters which saves quite a few.

Matlab is not good at encoding in different bases, so of the ideas I had for how to encode the data, this is the best I could think of. It turns out, that I can actually save quite a lot of bytes by resorting to directly accessing the Java Virtual Machine that Matlab is running to perform base64 decoding, followed by zip decompression. The input string was made by doing the reverse (compress then encode).

Hasn't Matlab got a "compression" function (like Python's zlib.compress)?

@friol nope - it can (de)compress a file, but not raw data. It may be possible to go really low level if the JVM has a compression function and call that directly.

Your solution transposed to Python (with zlib.compress) is around 2.500 bytes. You should try it :)

@friol managed to get it to work after a bit of messing, knocked over 1000 bytes off the code!

Still my solution in Python using your approach is 2644 bytes.

Python2.7 2645 2573
def X(n):
    import zlib,base64
    a=(ord(zlib.decompress(base64.b64decode("eNrt0wl31UQUwPGvdMEFsSJSqBsuqAgii1pFLYoFpC1Q2Qpu4IIVV9TP6qzJJJnkZXs503P+vyQzN3eSO333vYp4uxTZZaYWpDBLV0EhqdTsFQFoYffu3foKSZ4ZVJnmAol4zPKzjqScMnfdK9NcIBGPa3Zs1KMyzQUS8UTESJVpLpCIJz0pzGrUi4Mq01wgEXv8USDZkN/LnkLSpfIye+wcVI5tF7wefwLA6J7K7I0SP3e2l+YCiXh6YWFBFiqeUfYpss/pXnkfzQUS8Wxmfy3RV0TkwTDX+Ip6VPa3+Pv28xUBgz2Xk5pRz+FzVVKOTN3G7aTpZQCjOuDl0YGRKtNcIBGL3ciiZNHi4sECETN4B2kukIhDhw65KRO9Cd5oW5nmYudbWlKnIn7SOfGhiSRbtbmlpfCNchTEE3q+LMhFFu0D7SrzGwES8UI9iUR1j8Yq01wgES/WK6z1qNy4XbuI7wcY7/9cwn9qif6bd/6H558USMVLFWFuUGWaCyTiZU9F+laf9t4mBlSu3664MYA5Oxwjh82S2Dl8uviGLxGt0rzdzIivBil4xYhFOs6CVlGx8KQf49XOWlfmNwIk4rVm9oniG9lZeKxameYCiXi9IkgNq0xzsVMdOaJORUU2OJLNQSSFnDn9u9lZeTtPTemNqJp0+anmyo3b8VMCpvNmT3VvBpUbt5Py4wDm5q2WelSmudj5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crxqoMIA1fd9a6Ms0FEvFN1ViVaS6QiG8jRqpMc4FUfGdNtZs5AAAAAABAwfeaHctKa1JakiAXrVy7XbFaUw0AY7inqdFFJrxXVEq1rkxzgUTcvy/qiNDJYZVpLpCIH7w8qt4Vl9pWprlAIn5sJuUbk/CvVV8Xl7Vzw3biCgCYv5+8PApJdaV1ZZoLJOLnlmLvPjDcVKJWR/n7HvAVAYP9UiQ1d8VI9Jil6irTXCA529vb6orl7GDv1Cjmue3t8sPlerQUO9+vno0KOR31Lzzpx3jo5VGcmOOhGx/qV2dUbrEdPyOk7jfHBHkqEgUvBLe1dSf9FL+31KNy43bxiF8VMA9/RIxUmeYCifgzYqTKNBdIxF+Z0SvTXCARf2dGr0xzgUQ8Cok5o3pUbtxOHtF7YCr/ZEavTHOBRPybGb0yzQWS859ihhqNa7F6dZuUqjVF/wNUv6A7"))[n])-48)*2
    return 'XXRMVTRIFRLTTRPGSSOTORNUCAOGCIVSTOAOCNSVVCBIATALGEIMSPMIMBVACOSOLCBGBSCRLOPVNOVBPCVETVBLUDPNTSGOPDVIVRTNBZBOMOREPRFEROMNFCRNRAFIPTARSIMSLUPILIGRPOANPUMCAPFMTEPECHAQBAFGBRLETAMTBTNACEBNAVSAPZCBISCSCZKRRCVVPATPAGCLENCTSRRGME'[a:a+2]

Each zip has it's own character, use that as indice to grab code.
Compressing the lookup didn't work well, slight decrease in hash length, but penalty in decoding. Instead adapted to take in strings and inlined. Slight improvement. A lot uglier. Mmm
2572
import zlib,base64;a=(ord(zlib.decompress(base64.b64decode("eNrt0/l31UQUwPELLogVkULdcEFFEFnUKmpRLCBtgcpWcAMXrLii/v8/OmsySSZ52V7O9JzvJ8nMzZ3kTt99ryLeLkV2makFKczSVVBIKjV7RQBa2L17t75CkmcGVaa5QCIes/ysIymnzF33yjQXSMTjmh0b9ahMc4FEPBExUmWaCyTiSU8Ksxr14qDKNBdIxB5/FEg25Peyp5B0qbzMHjsHlWPbBa/HnwAwuqcye6PEz53tpblAIp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IGRPOANPUMCAPFMTEPECHAQBAFGBRLETAMTBTNACEBNAVSAPZCBISCSCZKRRCVVPATPAGCLENCTSRRGME"[a:a+2])

Some thoughts
Further optimization could include finding better arrangement of characters for compression. Limiting factor here is getting the data down.
This approach works fairly well since, since using only indices has inherently less entropy than trying to encode the entire zip. Given such long streaks of characters, the entire thing compresses pretty well. I initially tried compressing only the numbers of interest (so that I could implement a binary search) but ended up using more bytes than just the ordinal string I'm using here. There might be a smarter means of storing, but it's hard to beat the built-in compression.
I considered using a statistical approach, but it would be at best heuristic. A true functional representation would probably require just as many bytes if not more.

Works only with Python 2.7 for me (not 3).

Woops. Should probably specify that

Yeah the zlib encoding goes screwy in 3

Long "demo" answer in Python, 3755 chars
def f(c):
    import zlib
    import base64
    s=zlib.decompress(base64.b64decode('eJxN2VtyIzkOBdAtJQnw9SmpXR7H2JZGUumj97+QIe4FCXV0V5xGMZlMvkmdPk/fp9/T9XQ7/e90Pz1Pr/Pp/Hn+On+ff8/X8/38OD/P/15Ol/Pl4/Kfy9fl+/J7uV7ul8flefn34/fP5c/Hn88/X39+/tw/Pz6vn/evn6/Hf+/fl++P76/v6/fz++/P+efy8/Hz9fP7c/15/Dx/T7/X37/Xz+v9+rydbpfbP7eP2+ft6/Z7u97ut+ft7+11+/d+ul/uH/eZ4f3n/nu/Pk6Pr8f1cXvcH4/H63l6fjx/nzOD5/35eL7+/vOaRX9dXh+vr9f9NRO8XkfPx3Gk+Z84y/zD2Q7pZGnHUck6EyiY0jiOQcrMgmmTBkuwBluwB4cxzf9LKE52KjI0yoGSgvOBBlrSAw9mPFadHfkac98JLIfibEfKoOcwA4Ic1FkPEdATaJ9/laygoEdHmzmaO4kacnbLDBS1kpNjPeY51D4fSG/MQQ3W4PxsIWcJj8VubQHqfEUmi1gZyBlt5PxjJWhW9WRP+xVdIjpW9K28KaPdQKuf5ER58Z4EVJnMIKLWAI1R6TutoLygCqoPrcu3ZTQ4eHiDJ49KRAvqAVGWd/ZmvNgTeHktgU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jA0DNaV27g22NrX23khXbOdY1uEpMuyC0KyEFG1p2WpxmwRA6cVoyrWUptq0uBGC1ki+jg6Ku42Me5rfoGGVyZjbZHAIhfX0C/qQLbpqIjgiwZWRff8l193chuILaTSBgwoG+pQG5RJtf2trR9LgTRm41rNipNeLEEenTkpr5lNa56aq348de4XtFaxQRSQb8iJiXIxaf3Y23VQByUQOk7ahv1RhYUDqzcwIFjs+G6qfS+G9Pod3hGCfIGLttNJctAYvYC8UOhs+2o8ArUqJFWeX+W+q7qORy9E5ASUQwCkD3VL7nxD26rDrSxMXOvZRTusntfzdJLR7OIU7G9BbEbcw5sJYwVWzCw4fAOjmOnHZjiyb6iXn2gcM9V+/qREGT3BdmVyYqzP++zDr5kXY9p7jzHFmdjJn1fms2ojzy7puExjcSMT/JgDpYgdwqk7hwqGwvEb3PrfuhA/XTf1pHcuhs1ojxzkmNHi27WyKzmYGRW28phfaZ0vwgj+VsH6HekRlwAgWtDb/IGMHK2AkveCTiXkOhnYI0cKp4jx4qmeIW3PIiWn+tBHz3x12oj7mtICWoQv3+RNaLWFoz6B1Udh3eNyqG0oms5MEpQg+xeo47ks5FxDSe7a2LUuDqiDg6yAa5OkIZ61LjSjsFZLpPsGqQtLOBbWi8vyJznR1bP17gG75rYB7imqzy67yfJYt0dnHOf8y3tmtqMEtQg7h/+D74BxmY=')).decode("utf-8")
    c=int(c)
    i=220
    while i<len(s):
        p=int(s[i:i+3])
        x=int(s[i+3:i+8])
        g=int(s[i+8:i+11])
        if c>=x and c<=(x+g):
            return s[p*2:p*2+2]
        i+=11
    return'XX'

Data is packed in a base64-encoded and zlib-compressed string with the format:
pppcccccddd
where ppp is province index, ccccc is starting zipcode and ddd is delta.
For example, zipcodes for "RM" province (Rome) would be:
08200010004 (from 00010 to 00013)
08200015000 (from 00015 to 00015)

and so on.

There appears to be a flaw here. In your example of Rome, '00014' is not in the text document you linked to. Would your code not output RM for this instead of XX? There are other examples of this as well - '00070' to '00118' aren't there either.

Many zip codes for an area cannot be described through an interval (a,b).  The data are more complicated than that.

Fixed. Unfortunately, code has grown to 3,5kb...

Python 2, 2714
e='x\x9c5X\xcbr\xeb:\x0e\xdc\xeb[\xe4*\x91 Ar\xe9\xf8\xe6dR\x93\xc4\x1e\xdb\xc7\x8b\xfb\xff\x1f2\xdd\rd\x83\xa6(\x8a\x0f<\x1a\xa0\xde>j;\xcaq\xaaeG\xc3\xecd\x8eF9\x0e\xcaZNs{;\x8f\x83#\xcaN\xb4Sq6\xacF\x87\x8d\xc0VO\x95\xd8\x9b$\xc7p\x12HNB\xb4\xb2\xbd}YE\xf7NYO\x8dX\xb1\xb4\xd0\x03\xed8\rb\x0b\xc4\x1c\xdb\xdb\xcf\xac\xb1\x01\xa2I\xf6SYl\x18?\x9b1\xec\xdab\x9fcG\xc3\x0e\xc9zrb+\x18F\xc4w\xc2I\xd9\xb9\x06q\x9d\n\x87s\xc3-7\xdc\xb8\xe1\xc0\x86\x8d\x7f\x16\x9b\xa5\xe0cb\xc3\xd6\x81\x18\'4\xf5Ru\xc4\xa6\xa7fX\x908\xe2\x9b^N\x9d\xe8\x05K\x02G\xe2L\\\x1a\xb5\xec4\xb6\xb7\xe7\xf0\x03kA\x85\x8e\xbdH\x9ad\xdf\xde\xeeC\n\x1cR N:\xe2\xe8\x8f\xday\xf4\xdew4|\xca\x9a]F\xecq\x1c \x8e\x83\t\xfe\xb5\xc5\x91P\x80-~z\x7fo\xa1\\\x1cU\xda\xef\xc2!\x19z\xd1\x12\xf7\x8fE\x8b\x9e\xd6\xbe\x86\x9e\xcfmj\xc9\x9d\xc8S\x02\xeb!Y%\x1b\xf4\xd1\xa6\xc6^\xa6\x16\x9d;\x10\x06\x87m\xd0\xe8U\xb2I\xca\x8c\xebp\xbd\xf1\x8aO\x89017I\xa9S\x00q\x8a\xb6\xdd\xbf1\x1b\xb4\r\x95\x8e\x93\xcd\xbd\x0fh\xcb;\xcdQ\x16\xb6\x18\xa6\x83\xe1(\xbb\xa4K\x0e\xc9)\x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e#qF\tz\xac(Q\xb5\xae\x91\xb1^w\xfbM\xd2\xc6$-\xc9#\x00\xf9\x07D\xc8\xab<\x90\x05\x83:\x9c\x85\x89\xe5\x0eLtb#\x99k$s\x8d\xd2\xe0T\x8f\x15U\x85\x92\xe7bT.f\x1bv`\xf6\xbe\xbd\x9e%\x9dN7L\x12\x87\x91U\x8c\x17\xf3P\xf4\xb3D\x04\xc1D\x19hE\x81\x16\x1d\xfa\xdbR"\xb4^\x93W[\xa6\xc8\xc5\x08\xe2\xdf>F\x90\xb0%\xf6\xa2\x7f\x82\x8c\x1a={\xfc#\xa4*\xce\xafi\xf9\x0b\xc5~\x0bV\xa5Rl}\xca\xe7\xff\x0f.\x98vx'.decode('zlib').split();d={}
for s in e:
 d[s[:2]]=[]
 for g in s[2:].split(','):
  f=g.split('-');d[s[:2]].append(int(f[0]))
  if len(f)>1:
   for k in range(int(f[1])):
    d[s[:2]].append(int(f[0])+k+1)
def f(s):
 for g in d:
  if int(s) in d[g]:return g
 return'XX'

Provinces and zipcodes are stored in a zlib encoded file with the following structure:
BG24010-21,24033-36,24100,24121-8

Initially build a dictionary filled with all the values, then look up the province.


text:
Sum pyramid of primes
Given a number N, the challenge is to get the sum of the pyramid of N primes. To clarify things, here is an example:
Input: 4

We will list the first 4 primes, and then compute the sum of them. After that, we will compute the sums of the sums, and so on:
  2
    > 5
  3     > 13
    > 8      > 33
  5     > 20
    > 12
  7

You can see that the final result is 33. Here is another example, with N = 8:
   2
     >   5
   3       >  13
     >   8       >  33
   5       >  20       >  83
     >  12       >  50       > 205
   7       >  30       > 122       > 495
     >  18       >  72       > 290       > 1169
  11       >  42       > 168       > 674
     >  24       >  96       > 384
  13       >  54       > 216
     >  30       > 120
  17       >  66
     >  36
  19

You can see that the final result is 1169.
Here is another example with an odd N, N = 3:
 2
   > 5
 3     > 13
   > 8
 5

This gives us 13 as the result
Your task is to write a program or a function, that takes an integer greater than 0, and output the final result.
Here are some test results:
1:  2
2:  5
3:  13
4:  33
5:  83
6:  205
7:  495
8:  1169
9:  2707
10: 6169
11: 13889
12: 30993
13: 68701
14: 151469
15: 332349
16: 725837
17: 1577751
18: 3413221
19: 7349029
20: 15751187
21: 33616925
22: 71475193
23: 151466705
24: 320072415
25: 674721797
26: 1419327223
27: 2979993519
28: 6245693407
29: 13068049163
30: 27297614797
31: 56929779663
32: 118543624847
33: 246475746269
34: 511766428817
35: 1061264813321
36: 2198298700845
37: 4548996804811
38: 9405003164065
39: 19429190057417
40: 40107799133677
41: 82736199371081
42: 170553108953473
43: 351333736092089
44: 723224546040181
45: 1487710742395387
46: 3058157261678325
47: 6282142186547177
48: 12896743408107403
49: 26460652594917673
50: 54262186256186881
51: 111224391050741687
52: 227896496141836195
53: 466805185374509003
54: 955904519939662217
55: 1956988697590280537
56: 4005572366722212927
57: 8196803221276230093
58: 16769645303734608963
59: 34300013739423719561
60: 70136585692535099353
61: 143371352962891226373
62: 292978031452308375001
63: 598482012866917021541
64: 1222083126601616763473
65: 2494459637841415902073
66: 5089478703050176444803
67: 10379794709536133386939
68: 21160351440305258275579
69: 43119914481530819445497
70: 87833066190052490228187
71: 178841897161848754603319
72: 364014682565128163812791
73: 740654046243174781813209
74: 1506496270380756958474835
75: 3063280375436290387756263
76: 6227039507615221644290617
77: 12655020557561801933128885
78: 25712267089927372837530869
79: 52230425385198423845305957
80: 106076955379202815098486497
81: 215397386589448754140867649
82: 437308717912632286770415395
83: 887706233370396897803709611
84: 1801721089699452657985592689
85: 3656329898231436156162865559
86: 7418972676822310377574227797
87: 15051599987013574096449515927
88: 30532404546282900804722616529
89: 61926565462373271494414919017
90: 125582269494835615524470915169
91: 254631689768733901573206365479
92: 516210444730946464864091626473
93: 1046330617753410129672316234861
94: 2120493010460433691014704829565
95: 4296639990460140795780826898943
96: 8704509990931940668688755806845
97: 17631229933967301681217551193565
98: 35706243541395815998303171050377
99: 72298621492552303967009812018997

This is code-golf, so the shortest amount of bytes wins!

Is outputting the sum in a one-element list (e.g. [1169] for 8) acceptable?

@Mego Yes, as long as it's the final result

Must we support all test-cases up to 99? Many languages (e.g. JavaScript) can't count that high without losing accuracy.

@ETHproductions Only up to 27, which has the highest result lower than 2^32 - 1 (unsigned maximal int value)

Can you give an example of how to combine the terms with an odd N?

http://oeis.org/A007443

@GamrCorps I have added a new example.

J, 15 bytes
p:@i.+/ .*i.!<:

Explanation:
Basically the same as my Mathematica answer.
p:@i.+/ .*i.!<:
          i.!<:    binomial coefficients
p:@i.              first n primes
     +/ .*         dot product

Mathematica, 38 36 35 bytes
Prime[r=Range@#].Binomial[#-1,r-1]&

Minkolang 0.14, 17 bytes
n[i3M$i1-i6M*+]N.

Try it here and check all test cases here.
Explanation
n                    Take number from input (N)
 [                   Open for loop that repeats N times
  i                  Loop counter (n)
   3M                Pop n and push nth prime (where 2 is the 0th prime)
     $i1-            Max iterations - 1 (which is N-1)
         i           Loop counter (n)
          6M         Pop n,k and push kCn (binomial)
            *+       Multiply and add
              ]      Close for loop
               N.    Output as number and stop.

I use basically the same algorithm as several of the earlier answers that use binomial coefficients. Whenever you see such a pyramid of numbers being added, Pascal's triangle should be the first thing to come to mind. I don't see that any of the other answers have explained why this works, so I'll do that.
MORE explanation
2
  > [2,3]
3         > [2,3,3,5]
  > [3,5]             > [2,3,3,3,5,5,5,7]
5         > [3,5,5,7]
  > [5,7]
7

As you can see, the primes 2,3,5,7 appear 1,3,3,1 times in the final result. Lemme change the layout a bit.
_ _ _ 7
_ _ 5
_ 3
2

The number of times that the 3 will contribute to the final result is the same as the number of paths from the 3 to the upper-left corner, moving only up and left. Here, there are three such paths for the 3:
_    _    _ _
_    _ _    _
_ 3    3    3

Note that I can reverse the direction without loss of generality. So I want to know how many paths there are from the upper-left corner to each position along the jagged edge. I can count them like so...
1 1 1 1 1 . . .
1 2 3 4
1 3 6
1 4   .
1       .
.         .
.
.

For every number in this triangle, if it is X units from the left and Y units from the top, then the number at that position is

The way I use it, though, X+Y = N is constant and X ranges from 0 to N, which goes along one diagonal. I multiply each coefficient with the corresponding prime number and then add it all up.
See the Wikipedia article on Pascal's triangle for more on this.

I find the explaination quite beautiful +1

JavaScript ES7 107
Abusing the fixed limit at 27 - how boring is actually finding the primes.

n=>eval("t=2;for(p=[for(v of'012242424626424662642646842')t-=-v];--n;)p=p.slice(0,n).map((v,i)=>v+p[i+1])")

Test snippet (using array comprehension it will work only in Firefox)

F=n=>eval("t=2;for(p=[for(v of'012242424626424662642646842')t-=-v];--n;)p=p.slice(0,n).map((v,i)=>v+p[i+1])")

// Less golfed

Q=n=>{
  t=2;
  // Note: the golfed version will return the last computed value, that is p if the loop is entered, else t=2
  p=[for(v of '012242424626424662642646842') t-=-v] // build the array of first 27 primes in p
  while(--n) p = p.slice(0,n).map((v,i)=>v+p[i+1])
  return p
}

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

for(i=1;i<28;i++)console.log(i+' : '+F(i))

Is it possible to shorten the code by using regex prime check?

Pyth, 16 bytes
s*V.cLtQQ.f}ZPZQ

Very simple actually:
s*V          ; Dot product of
  .cLtQQ     ; the binomial coefficients for n
  .f}ZPZQ    ; and the first n prime numbers.

Pyth - 16 15 bytes
Uses reduce and first_n filter.
u+VGtGtQ.f}ZPZQ

Test Suite.

Pyth, 18 bytes
husM.:G2tQ.f}ZPZQ0

Try it online: Demonstration
Explanation:
husM.:G2tQ.f}ZPZQ0   implicit: Q = input number
          .f    Q0   find the first Q numbers Z >= 0, which satisfy
            }ZPZ        Z appears in the prime factorization of Z
                     this gives the first Q prime numbers
 u      tQ           assign this list to G and repeat the following Q-1 times:
    .:G2               create all subarrays of length 2
  sM                   sum them up and update G
h                    take the first element (=result) and print

Also 18: s*V.cLtQUQ.f}ZPZQ0

@Sp3000 Oh wow, this is very similar to my answer - but I didn't look at your comment.

Shell + GNU and BSD utilities, 92
echo `primes 1|sed $1q`|sed -r ':
s/(\w+) (\w+)/$((\1+\2)) \2/
t
s/ \w+$//
s/^/echo /e
/ /b'

Haskell, 74 bytes
import Data.Numbers.Primes
f n=([]:iterate(zipWith(+)=<<tail)primes)!!n!!0

Usage example:
*Main> map f [1..12]
[2,5,13,33,83,205,495,1169,2707,6169,13889,30993]

How it works: repeatedly calculate the neighbor sums of all primes. Take the head of the nth iteration.
[2,3,5,7,11,13,17,19,23,29,...]             -- plain primes (and 1st iteration)
[5,8,12,18,24,30,36,42,52,60,...]           -- 2nd iteration of neighbor sums
[13,20,30,42,54,66,78,94,112,128,...]       -- 3rd iteration
[33,50,72,96,120,144,172,206,240,274,...]
...

As the index operator !! is zero based, I'm prepending an empty list to avoid having to use !!(n-1).

Matlab, 76 bytes
Thanks to David for saving a lot of bytes!
n=input('');x=primes(103);
for s=2:n,x=conv(x,[1 1]);end
disp(num2str(x(n)))

Old version, 98 bytes
n=input('');m=1;x=[];while nnz(x)<n
m=m+1;x=primes(m);end
for s=2:n,x=conv(x,[1 1]);end
disp(x(n))

Making x using x=primes(103); saves some bytes, since you only need to go up to N=27 (and it doesn't matter if x has more entries than you need). conv was a great idea though!

@David Thanks! I hadn't seen the challenge was only up to 27

JavaScript (ES6), 121 bytes
n=>eval(`for(p=[],c=0,x=1;c<n;s?p[c++]=x:0)for(s=i=++x;--i>1;)x%i?0:s=0;for(;--c;p=s)for(i=c,s=[];i;)s[c-i]=p[i]+p[--i]`)

Explanation
Most of the size comes from finding the prime numbers.
n=>
  eval(`                   // eval used to enable for loops without {} or return

    // Get primes up to n
    for(                   // loop from range 2 to n
      p=[],                // p = primes
      c=0,                 // c = count of primes
      x=1;                 // x = current number to check for primality
      c<n;
      s?p[c++]=x:0         // add the number to the primes if it has no divisors
    )
      for(                 // loop from range 2 to x to check for divisors
        s=                 // s = true if x is a prime
          i=++x;
        --i>1;
      )
        x%i?0:s=0;         // check if x has a divisor

    // Sum primes
    for(;--c;p=s)          // while the new pyramid has pairs to sum
      for(i=c,s=[];i;)     // loop through each pair of the pyramid
        s[c-i]=p[i]+p[--i] // push the sum of the pair to the new pyramid s
  `)                       // implicit: return the final sum

Test

<input type="number" id="input" value="0" oninput="result.textContent=(

n=>eval(`for(p=[],c=0,x=1;c<n;s?p[c++]=x:0)for(s=i=++x;--i>1;)x%i?0:s=0;for(;--c;p=s)for(i=c,s=[];i;)s[c-i]=p[i]+p[--i]`)

)(+this.value)" />

Seriously, 23 bytes
,r`P`M;lD`;pX@dXZ'Σ£M`n

Outputs the result as a list of length 1: 8 -> [1169]
Try it online
Explanation:
,r`P`M    push the first n primes as a list
;lD       push 1 minus the length of the list (we'll call this k) ([2,3,5,7],3)
`...`n    call the following function k times:
    ;pX      duplicate the list, pop and discard the first element
    @dX      swap, pop and discard the last element
    Z        zip the two lists
    'Σ£      push the string "Σ" and convert to function
    M        map the function over the list

Fig, \$18\log_{256}(96)\approx\$ 14.816 bytes
tF@pmC
?!{Lx[xoX+p

-6.585 bytes thanks to @Seggan
Try it online!
Explanation:
tF@pmC  #
t       # Take the first n from
    mC  # all positive integers
 F      # filtered by
  @p    # is prime.

?!{Lx[xoX+p  #
?            # If
 !           # not
   L         # length of
    x        # the list
  {          # decremented,
     [       # return the first item
      x      # from the list
       o     # otherwise call
        X    # the current function
         +   # the list plus
          p  # the list with the first removed

26 -> 18 chars. Fig is missing so many useful builtins

@Seggan Could you explain in chat?

Ruby -rprime, 66 62 bytes
-4 bytes thanks to south
->n{a=Prime.take n
(eval"a=a.each_cons(2).map &:sum;"*~-n)[0]}

Attempt This Online!

you can use #take here and .map{_1+_2} is .map &:sum, saves 2 bytes total

changing how you loop yields 62 bytes

@south Nice work. Thanks!

Mathematica 73 bytes
NestWhile[Plus@@@Partition[#,2,1]&,Prime@n~Table~{n,#},Length@#>1&][[1]]&

How it works
Prime@n~Table~{n,#}& gives a list of the first # primes.
Partition[#,2,1]& rearranges a list of numbers, {a, b, c, d ...} as
{{a,b}, {b,c}, {c,d}...}}.
Plus@@@ then returns {a+b, b+c, c+d...}.
NestWhile begins with the list of # primes and repeatedly applies Plus@@@Partition... as long as there is more than one number in the list.

NestWhile[Plus@@@Partition[#,2,1]&,Prime@n~Table~{n,#},Length@#>1&][[1]]&[4]

33

NestWhile[Plus @@@ Partition[#, 2, 1] &, Prime@n~Table~{n, #}, Length@# > 1 &][[1]] &[5]

83

It takes about 1/5 sec to solve for the first 1000 primes.
NestWhile[Plus @@@ Partition[#, 2, 1] &, Prime@n~Table~{n, #},
 Length@# > 1 &][[1]] &[10^3] // AbsoluteTiming

{0.185611,
  1917231113909474354152581359443368948301825453723617274940459548079399
  7849439430405641625002631859205971635284844253657654843025188471660669
  0868945436580032828177831204066809442374364181056590286849530757875874
  9185665854180901580438781223737728559484382552514103542932932981340942
  3918431043908415228663677}

Python 2, 159 bytes
m=int(input())
q=[]
x=2
while len(q)<m:
 if not any([x%g<1 for g in q]):q+=[x]
 x+=1
for i in range(m-1):
 for p in q:q+=[q[1]+q[0]];q.pop(0)
 print(q.pop())
print q

Maybe I'm missing something...but why the print command inside the loop?  Don't you want to print just once, at the end?

Ceylon, 169 bytes
alias I=>Integer;I s(I*l)=>l.size<2then(l[0]else 0)else s(*l.paired.map((I[2]i)=>i[0]+i[1]));I p(I n)=>s(*loop(2)(1.plus).filter((c)=>!(2:c-2).any((d)=>c%d<1)).take(n));

This defines two functions – s calculates the pyramid sum of a sequence of integers, while p calls this on the sequence of the first n primes.
Looks like about half the size is finding the first n primes, other half is calculating the pyramid sum.
Here is a formatted/commented version:
// Sum pyramid of primes
//
// Question:  http://codegolf.stackexchange.com/q/65822/2338
// My answer: http://codegolf.stackexchange.com/a/65879/2338

alias I => Integer;

// Calculate the pyramid sum of some sequence.
I s(I* l) =>
        // If less than two elements ...
        l.size < 2
        // then use the first (only element), or 0 if no such.
        then (l[0] else 0)
        // otherwise,
        else s(*
               // take the iterable of pairs of consecutive elements,
               l.paired
               // and add each of them together.
                .map((I[2] i) => i[0] + i[1])
               // then apply s (recursively) on the result.
               );

// Calculate the pyramid sum of the first n primes.
I p(I n) => s(*
              // the infinite sequence of integers, starting with 2.
              loop(2)(1.plus)
              // filter by primality (using trial division)
              .filter((c) => !(2 : c-2)
                              .any((d) => c%d < 1))
              // then take the first n elements
              .take(n)
              // then apply s on the result.
             );

@FlagAsSpam done ... sorry, I somehow forgot that.

Milky Way 1.4.8, 26 25 bytes
This answer is not competing. Some of the operations were created after this question was posted (but not necessarily for this challenge).
'E&{~F§{G}:y1ba?{_^_}};!

I was able to remove a byte after reading through the comments. Output is a single-element list.

Explanation
'                        #  read input from the command line
 E                       #  push a list of the first N primes
  &{~                }   #  while loop
     F                   #  push the sum of TOS elements i.e. [A, B, C] => [[A,B], [B,C]]
      §{ }               #  mapping
        G                #  sum i.e. [1, 2, 3] => 6
          :              #  duplicate the TOS
           y             #  push the length of the TOS to the stack
            1            #  push 1 to the stack
             b           #  evaluate equality of the TOS and STOS
              a          #  logical not
               ?{_ _}    #  if-else statement
                  ^      #  pop the TOS
                     ;   #  swap the TOS and STOS
                         #  dump the TOS to the stack
                      !  #  output the TOS

Usage
python3 milkyway.py <path-to-code> -i <input-integer>

Jelly, 7 bytes
ÆN€+ƝƬṀ

Try it online!
Originally I wrote a Brachylog answer, 1<|~lṗᵐ≠≜{s₂ᶠ+ᵐ}ⁱ~g, but when it came out to 19 bytes I decided that I should probably try a different language.
      Ṁ    The largest value from
     Ƭ     every stage of repeatedly
   +       adding
    Ɲ      adjacent values, starting with
ÆN         nth prime
  €        mapped over the input.

Apparently, mapping over a number treats it as a range from 1 to itself inclusive, and integers sort as greater than lists or whatever '' is.

APL(NARS), 41 chars, 82 bytes
{1=≢⍵:↑⍵⋄∇+/¨¯1↓⍵,¨1⌽⍵}∘{⍵↑v/⍨0πv←⍳1+⍵×⍵}

In input if one want to use big number has to enter the type number_x as 47x.
There could be something not ok: i here write that n primes are in the set 1..n^2
Test:
  h←{1=≢⍵:↑⍵⋄∇+/¨¯1↓⍵,¨1⌽⍵}∘{⍵↑v/⍨0πv←⍳1+⍵×⍵}
  h 1
2
  h 2
5
  h 9
2707
  h 24
320072415
  h 47x
6282142186547177
  h 99x
72298621492552303967009812018997
  h 200x
433205808657246411262213593770934980590715995899633306941417373

Perl 6, 52 bytes
{grep(&is-prime,1..*)[^$_],{[|$_]Z+.skip}...1& &say}

Try it online!
Anonymous code block that takes an argument and prints out a one element list containing the result.

Husk, 7 bytes
ΩεẊ+↑İp

Try it online!
Pretty straighforward.

Japt -h, 11 bytes
_j}jU
Å£=ä+

Try it

Vyxal G, 7 bytes
ʁǎ≬2lṠ↔

-1 byte thanks to Steffan
Try it online, see a flagless version, or verify more test cases.
Explanation:
ʁ        # Range from 0 to n
 ǎ       # Nth prime (vectorising)
  ≬      # Three element lambda that:
   2l    #   Gets overlapping groups of 2
     Ṡ   #   And sums each of them
      ↔  # Apply that function until no change and collect intermediate results
         # Get the maximum item of of those results with the G flag

7 bytes with a flag

Ah, nice. I had a go with that approach but forgot about ¨p.

@Steffan wait, I don't think that works with n = 1

fix by replacing İ with ↔

Also, you don't need ¨p, you can also just do ʁǎ≬2lṠ↔

@Steffan oh okay

Pyt, 10 bytes
Đ`ŕʁ+ĐŁ⁻łŕ

Try it online!
Đ              Implicit input; duplicate list
 `      ł      Do... while top of stack is not 0
  ŕ            Remove top of stack
   ʁ+          Reduce by addition
     ĐŁ⁻       Get the length of the resultant array and subtract 1
         ŕ     Remove the pesky 0; implicit print

Stax, 13 bytes
ä/($◘é∟o¶Vƒm^

Run and debug it

05AB1E, 6 bytes
ÅpIGü+

Outputs the result wrapped in a list.
Try it online or verify all test cases.
Explanation:
Åp      # Push a list of the first (implicit) input amount of primes
  IG    # Loop the input-1 amount of times:
    ü   #  For each overlapping pair of integers in the list:
     +  #   Add them together
        # (after which the result is output implicitly)

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳


text:
Can an ant spell words by walking on cube?
Write a function that takes two parameters: a positive integer n and a list of words.
Given a cube of n-by-n-by-n units, assign a random letter (A-Z) to each surface unit.  (For a 3x3x3 cube, there would be 9 surface units on each face.)
Then determine whether it's possible for an ant walking along the surface (with the ability to cross faces) to spell each of the supplied words.  Assume that to spell a word, the letters must be up/down or left/right adjacent, but not necessarily on the same face.  [Edit, for clarity: The ant can reverse its path and use letters more than once.  Each surface unit counts as one character, so to spell a word with repeated letters (e.g. "see") the ant would have to visit three adjacent units.]
The function should output two things:
1) Each of the letters on each face, in such a way that the topology can be inferred.  For instance, for a 2x2x2 cube, an acceptable output would look like:
   QW
   ER
TY OP UI
DF JK XC
   AS
   GH
   LZ
   VB

2) Each of the words, along with a boolean representing whether it's possible for the ant to spell the word by walking along the surface of the cube.  For instance:
1 ask
0 practical
1 pure
0 full

Bonus challenge (will not factor into score, just for fun): Instead of n representing only the size of the cube, let n also represent the dimensionality of the shape.  So, an n of 2 would yield a 2x2 square; an n of 3 would yield a 3x3x3 cube; and an n of 4 would yield a 4x4x4x4 tesseract.

I think you need to provide further specification as to how the cube should be output. For example, can all the letters be on one line, provided we always know how they're supposed to be arranged?

So long as the topology can be inferred, I don't want to place any additional limitations on how the letters are output.  My multi-line example in the description was illustrative, rather than proscriptive.

It looks like the ant is able to change direction; this should be stated explicitly. Can it make a 180-degree turn, and can it use the same letter twice in a row? In other words, can you find qwq or qq in the example cube?

Furthermore, can the ant use a letter more than once?

What are the rules for distribution of the random letters? Your example shows no repeated letters, yet with a simple algorithm where each letter is picked independently out of 26 possibilities, the chances of zero repeats is highly unlikely. Obviously with N>2 there will have to be repeats. You should specify this more clearly, in case someone tries a cube with only two different letters distributed randomly over the whole cube.

Random means what random ordinarily means.  Ignore the lack of randomness in the example, which was mostly to illustrate a way to output the cube data in a way that topology can be inferred.  Alphabet should be A-Z.

Ruby, 272 bytes
Two unnecessary newlines are added to the code either side of nested function g to improve readability. These are excluded from the score. The characters f= which assign the anonymous function to a variable are also excluded.
Output format is 0 or 1 per the question instead of Ruby's native true and false. A newline (rather than a space) is used to separate the boolean and the word. My understanding is that this is an acceptable interpretation of the output requirements, but if not, the impact on the byte count would be minor.
f=->n,l{c=''
x=[p=6*n,1,-p,-1]
(m=3*p*n).times{|i|c<<(5+i/n%6-i/n/p&6==6?65+rand(26):i%p==p-1?10:46)}
q=m+3*n
puts c

g=->w,i,d{w==''?$r=1:c[i]<?A?g[w,(i+x[d])%q,d^1]:w[0]==c[i]&&4.times{|j|g[w[1..-1],(i+x[j])%q,j^1]}}

l.each{|w|$r=0
m.times{|i|c[i]>?@&&g[w,i,0]}
puts $r,w}}

Output
After about 50 calls like this:
f[4,['PPCG','CODE','GOLF','ANT','CAN','CUBE','WORD','WALK','SPELL']]

I finally got the following output with 2 hits. ANT is at the bottom right going upwards, and the AN is shared by CAN, with the C wrapping round to top left.
....KCAAXRHT...........
....ALRZXRKL...........
....NDDLCMCT...........
....ETQZHXQF...........
........FYYUSRZX.......
........CFNPAUVX.......
........ZTJVHZVQ.......
........AUWKGVMC.......
............XWKSDWVZ...
............DPLUVTZF...
............DMFJINRJ...
............ZRXJIAFT...
0
PPCG
0
CODE
0
GOLF
1
ANT
1
CAN
0
CUBE
0
WORD
0
WALK
0
SPELL

Explanation
The particular unfolding of the cube selected, was chosen partly for its ease of drawing, but mainly for its ease of searching.
The non-alphabet characters (the dots plus the newline at the end of each line) are an important part of the field where the ant may be found walking.
Searching is performed by the recursive function g, which is nested in function f . If the word passed is an empty string the search is complete and $r is set to 1. If the ant is on a letter square which corresponds to the first letter of the word, the search is continued in all four directions: the function is called again with the word shortened by removing its first letter. In this case the direction parameter is ignored. The moving is done by recursively calling with the cell index altered by the values in x. The result of the addition is taken modulo the size of the grid plus an extra half line. This means that the bottom line wraps round to the top and vice versa, with the correct horizontal offset.
If the ant is on a non-letter square, she must zigzag in a staircase motion until she finds a letter square. She will zizag in southeast or northwest direction. This is simulated by recursive calls with the d parameter being XORed with 1 each time to keep track of her movement. Until she reaches the next letter square, there is no shortening of the input word. Conveniently, this may be done by the same recursion as is used when we are searching in the area with letters. The difference is, the recursion has only one branch when the ant is in the whitespace area, as opposed to 4 in the letter area.
Commented code
->n,l{                                   #n=square size, l=list of words to search
  c=''                                   #empty grid
  x=[p=6*n,1,-p,-1]                      #offsets for south, east, north, west. p is also number of characters per line
  (m=3*p*n).times{|i|                    #m=total cells in grid. for each cell
    c<<(5+i/n%6-i/n/p&6==6?              #apppend to c (according to the formula)
      65+rand(26):                       #either a random letter
      i%p==p-1?10:46)                    #or a "whitespace character" (newline, ASCII 10 or period, ASCII 46)
  }
  q=m+3*n                                #offset for vertical wraparound = grid size plus half a row.
  puts c                                 #print grid

  g=->w,i,d{                             #search function. w=word to search for, i=start index in grid, d=direction
    w==''?                               #if length zero, already found,
      $r=1:                              #so set flag to 1. Else
      c[i]<?A?                           #if grid cell is not a letter
        g[w,(i+x[d])%q,d^1]:             #recursively call from the cell in front, with the direction reflected in NW-SE axis
        w[0]==c[i]&&                     #else if the letter on the grid cell matches the start of the word
          4.times{|j|                    #for each direction (iterate 4 times, each time a different direction is "in front")
            g[w[1..-1],(i+x[j])%q,j^1]}  #recursively call from the cell in front. Chop first letter off word.
   }                                       #Direction parameter is XORed (reflected in NW-SE axis) in case ant hits whitespace and has to zigzag.

   l.each{|w|                            #for each word in the list
     $r=0                                #set global variable $r to zero to act as a flag
     m.times{|i|c[i]>?@&&g[w,i,0]}       #call g from all cells in the grid that contain a letter
     puts $r,w}                          #output flag value and word
}