What is the average of n, the closest prime to n, the square of n and the closest Fibonacci number to n? This is a math problem which takes quite many things into question, making it rather challenging, and as you might have guessed, it's a code golf, so it should be as short as possible as well.
The input, \$n\$, is any integer number (should at least support integers, but needn't be limited to). The output is the average of:

\$n\$
The square of \$n\$, \$n^2\$
The closest prime number to \$n\$, \$p\$
The closest number to \$n\$ in the Fibonacci sequence, \$f\$

Shortly, the program should print to the standard output channel the result of $$\frac {n + n^2 + p + f} 4$$.
You don't have to care about possible overflows etc. Normal floating point precision is also ok.
The way the input is given is completely up to you. Shortest program (in characters) wins, as always with code golfs.
In the case a tie occurs when you are looking for the closest, choose one of the following:

Go up
Go down
Choose one randomly
Python 160 Chars

p=lambda n:any(n%x&lt;1for x in range(2,n))
N=input()
a=0;b=1
while b&lt;N:a,b=b,a+b
c=d=N
while p(c)and p(d):c-=1;d+=1
print (N+N*N+[b,a][2*N-a-b&lt;0]+[c,d][p(c)])/4.0


A little explanation about the closestFib part:


  When the while loop ends a is smaller
  than N and b is either equal to or
  greater than N. Now the
  [b,a][2*N-a-b&lt;0] part. Look at it as
  [b,a][(N-a)-(b-N)]. (N-a) is the
  difference between N and a and
  similarly (b-N) the difference between
  b and N. If the difference between
  these two is less than 0 it means a is
  closer to N and vice-versa.