Note: this problem is not suitable for hints! I suggest you read the linked stackexchange post and figure it out yourself before reading further!!
Fun problem that relies on a neat trick, learnt it from this post: https://math.stackexchange.com/questions/1536761/limit-with-fractional-part-lim-limits-n-to-infty-2-sqrt3n
We now have a condition to ensure that the fractional part of (sqrt(p) + sqrt(q))^(2n) goes to 1!
Therefore, we just need to sum ceiling(-2011/log(p + q - 2sqrt(pq))) for all p < q such that p + q ≤ 2011 and 0 < p + q - 2sqrt(pq) < 1
Input an integer (yourinput)
Code outputs ΣN(p, q) for p + q ≤ yourinput