Binary Quadratic Form II (noch nicht übersetzt)

Problem 769

Consider the following binary quadratic form:

f(x,y)=x2+5xy+3y2

A positive integer q has a primitive representation if there exist positive integers x and y such that q=f(x,y) and gcd(x,y)=1.

We are interested in primitive representations of perfect squares. For example:
172=f(1,9)
872=f(13,40)=f(46,19)

Define C(N) as the total number of primitive representations of z2 for 0<zN.
Multiple representations are counted separately, so for example z=87 is counted twice.

You are given C(103)=142 and C(106)=142463

Find C(1014).