How many pairs of integers (not necessarily positive) are there such that both a2+6b2 and b2+6a2 are both squares?

To determine the number of pairs of integers satisfying the given conditions, we can solve the problem step by step.

First, let's consider the equation a^2 + 6b^2 = x^2, where x is a square number.

We know that x^2 is always non-negative, so a^2 + 6b^2 must also be non-negative. Since a and b can be any integer (positive, negative, or zero), we can conclude that a^2 + 6b^2 is non-negative for all pairs of integers (a, b).

Now, let's simplify the equation a^2 + 6b^2 = x^2 further. We can rewrite it as:
a^2 = x^2 - 6b^2.

This equation resembles the form of a Diophantine equation in the theory of numbers. Specifically, it resembles a Pell-like equation, where we have to find integer solutions for a and b.

A well-known property of Pell-like equations is that if (a, b) is a solution, then so is (-a, b), (a, -b), and (-a, -b).

Therefore, let's consider a new question: How many positive (a, b) pairs satisfy a^2 + 6b^2 = x^2? We can multiply the resulting number by 4 to account for all four quadrants.

Using the equation a^2 = x^2 - 6b^2, we can observe that a is also a square number.

Now, we need to break down the equation into two possibilities:

1) When a is even:
In this scenario, let's substitute a = 2c, where c is an integer.
The equation becomes (2c)^2 = x^2 - 6b^2, which simplifies to 4c^2 = x^2 - 6b^2.
Rearranging, we get x^2 - 4c^2 = 6b^2.

This equation resembles another Diophantine equation known as Pell's equation, where we have to find integer solutions for x and c. Pell's equation can be rewritten as x^2 - Dy^2 = 1, where D is a non-square positive integer.

In our case, D = 24, and the equation becomes x^2 - 24c^2 = 1.

The solutions to this equation can be found using the theory of continued fractions, but for our purposes, we can find them through an algorithmic approach.

By listing out the positive solutions (x, c), we can find that the pairs that satisfy the equation a^2 + 6b^2 = x^2 are (2c, b) = (2c, ±c), where c is an integer. This accounts for 2c possible pairs for each positive c.

2) When a is odd:
In this scenario, let's substitute a = 2c + 1, where c is an integer.
The equation becomes (2c + 1)^2 = x^2 - 6b^2, which simplifies to 4c(c + 1) = x^2 - 6b^2.

Similar to the even case, we can rewrite it as:
x^2 - 24b^2 = 4c(c + 1).

Again, this is a Pell's equation, where D = 24. The solutions to this equation are given by (x, b), which can be found through an algorithmic approach.

By listing out the positive solutions (x, b), we can find that the pairs that satisfy the equation a^2 + 6b^2 = x^2 are (2c + 1, b) = (2c + 1, ±b), where c is an integer. This accounts for 2c + 1 possible pairs for each positive c.

Adding up all the possibilities, we have:
- For c = 1, we have 2 pairs.
- For c = 2, we have 5 pairs.
- For c = 3, we have 10 pairs.

Thus, the total number of positive pairs (a, b) satisfying a^2 + 6b^2 = x^2 is 2 + 5 + 10 = 17.

Since we accounted for all quadrants, the total number of pairs (a, b) is 4 * 17 = 68.

Therefore, there are 68 pairs of integers (a, b) such that both a^2 + 6b^2 and b^2 + 6a^2 are squares.