## Given a non-square integer $d$, any real $x$ can be approximated arbitrarily close by quadratic integers $a+b\sqrt{d}$, where $a,b$ are integers. For example, the following inequalities approximate $\pi$ with precision $10^{-13}$:

$$4375636191520\sqrt{2}-6188084046055 < \pi < 721133315582\sqrt{2}-1019836515172 $$
We call $BQA_d(x,n)$ the quadratic integer closest to $x$ with the absolute values of $a,b$ not exceeding $n$. We also define the integral part of a quadratic integer as $I_d(a+b\sqrt{d}) = a$.
You are given that:
$BQA_2(\pi,10) = 6 - 2\sqrt{2}$
$BQA_5(\pi,100)=26\sqrt{5}-55$
$BQA_7(\pi,10^6)=560323 - 211781\sqrt{7}$
$I_2(BQA_2(\pi,10^{13}))=-6188084046055$Find the sum of $|I_d(BQA_d(\pi,10^{13}))|$ for all non-square positive integers less than 100.

### The question involves advanced concepts of number theory which may be hard to grasp without rigorous study in the field. The problem you have provided involves finding a Quadratic Integer in a given range that is closest to a number, hence it is a problem of Diophantine approximation in a specific set of numbers, the Quadratic Integers.

The Quadratic Integers are a special kind of Algebraic Integers formed when you include an integer square root of a non-square integer to the set of Integers. A Quadratic Integer has the form of $a+b\sqrt{d}$ where $a, b$ are integers and $d$ is a non-square integer.

The goal is finding the Quadratic Integer closest to $\pi$ with absolute value of coefficients $a , b$ not exceeding $10^{13}$ and summing the integral parts over all $d$ where $d$ is a non-square positive integers less than 100.

However, this is a very complex problem, as it involves searching in a high-dimensional space (each ‘degree of freedom’ corresponds to a possible value of $d$), and there is no easy way to navigate this space. This is a computationally challenging problem, and it is likely to require the use of a high-performance computing cluster and sophisticated numeric and symbolic computation algorithms. Also, this kind of problem is not generally solvable by hand or simple computational means. You’d likely need to use an approach that combines number theory, combinatorics, and computational mathematics.

This problem seems to be akin to a Project Euler type problem, or similar mathematical/computational challenges, where solutions require clever and tailored algorithms, not straightforward simple calculations.

##### More Answers:

Quintinomial CoefficientsPoohsticks Marathon

Sets with a Given Least Common Multiple