← RoseCode

ROSECODE 141

Lattice points

sinan · Math ·

For a,b,c,d all being positive integers, we have the following:

L1: y=(b/a)*x
L2: y=-(a/b)*x+a
L1 and L2 cross at a P(c,d) point.
The distances from P to origin (0,0) and to (0,a) and to (b,0) points are all integers.

Let f(R) denote the number of (a,b,c,d) solutions if P is inside x^2+y^2=R^2 circle.

You are given:
f(10^5)=3782

What is f(10^19)?

[My timing: <100ms]