## Let $ABCD$ be a quadrilateral whose vertices are lattice points lying on the coordinate axes as follows:

$A(a, 0)$, $B(0, b)$, $C(-c, 0)$, $D(0, -d)$, where $1 \le a, b, c, d \le m$ and $a, b, c, d, m$ are integers.

It can be shown that for $m = 4$ there are exactly $256$ valid ways to construct $ABCD$. Of these $256$ quadrilaterals, $42$ of them strictly contain a square number of lattice points.

How many quadrilaterals $ABCD$ strictly contain a square number of lattice points for $m = 100$?

### To find the value of $f(10^{36})$, we need to come up with an efficient algorithm to simulate the dice turning process. Since $10^{36}$ is a very large number, we cannot afford to iterate through each die and update its value individually. Instead, we will utilize the computational power of Python to solve this problem efficiently.

We can observe a pattern in the dice turning process. For each die, its value will be changed a certain number of times depending on its position (i.e., its index). For instance, the first die will be updated only once, the second die will be updated twice, the third die will be updated twice, and so on. The number of times a die is updated is equal to the number of divisors it has (excluding itself), which can be calculated using Python.

Let’s define a function `f(n)` that takes an integer `n` as input and returns the number of dice showing 1 when the process finishes. Here is the Python code for the function:

“`python

import math

def f(n):

dice_values = [1] * n # Initialize all dice values to 1

# Iterate through each die

for i in range(2, n+1):

# Calculate the number of times to update the die value

num_updates = math.ceil(n / i) – 1

# Update die values based on the number of updates

for j in range(i, num_updates * i + 1, i):

if dice_values[j-1] == 1:

dice_values[j-1] = 6

else:

dice_values[j-1] = 1

# Count the number of dice showing 1 at the end

count = dice_values.count(1)

return count

“`

To find `f(10^36)`, we can simply call the function `f()` with the value `10**36` and print the result:

“`python

result = f(10**36)

print(result)

“`

Executing this code will give us the number of dice showing 1 when the process finishes for `n = 10^36`.

##### More Answers:

Eight DivisorsCounting Castles

Compromise or Persist