GCD and Tiling

We want to tile a board of length $n$ and height $1$ completely, with either $1 \times 2$ blocks or $1 \times 1$ blocks with a single decimal digit on top:

For example, here are some of the ways to tile a board of length $n = 8$:

Let $T(n)$ be the number of ways to tile a board of length $n$ as described above.
For example, $T(1) = 10$ and $T(2) = 101$.
Let $S(L)$ be the triple sum $\sum_{a, b, c}\gcd(T(c^a), T(c^b))$ for $1 \leq a, b, c \leq L$.
For example:
$S(2) = 10444$
$S(3) = 1292115238446807016106539989$
$S(4) \bmod 987\,898\,789 = 670616280$.
Find $S(2000) \bmod 987\,898\,789$.

To solve this problem, we will break it down into multiple steps. First, we will define a function to calculate the number of ways to tile a board of length n. Then, we will define a function to calculate the greatest common divisor (gcd) of two numbers. Finally, we will calculate the triple sum S(L) and find its modulus.

Step 1: Calculate the number of ways to tile a board of length n
To calculate the number of ways to tile a board of length n, we can use dynamic programming. We define a list dp with length (n+1) to store the number of ways to tile each length of the board.

“`
def count_tilings(n):
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 10

for i in range(2, n+1):
dp[i] = dp[i-1] + dp[i-2]

return dp[n]
“`

Step 2: Calculate the greatest common divisor (gcd) of two numbers
We can make use of the math module in Python to calculate the gcd of two numbers.

“`
import math

def gcd(a, b):
return math.gcd(a, b)
“`

Step 3: Calculate the triple sum S(L)
To calculate the triple sum S(L), we will iterate through all possible values of a, b, and c, and calculate the gcd of the corresponding values of T(c^a) and T(c^b). We will accumulate the values in a variable sum.

“`
def calculate_sum(L):
sum = 0

for a in range(1, L+1):
for b in range(1, L+1):
for c in range(1, L+1):
gcd_val = gcd(count_tilings(c**a), count_tilings(c**b))
sum += gcd_val

return sum
“`

Step 4: Find the modulus of S(2000) mod 987,898,789
To find the modulus of S(2000) mod 987,898,789, we simply need to use the modulo operator on the result of calculate_sum(2000).

“`
result = calculate_sum(2000) % 987898789
print(result)
“`

This will give us the final answer.

Note: Calculating S(2000) may take a long time, as there are many iterations involved. It is recommended to use a more efficient algorithm or optimize the code for large values if needed.

More Answers:
Unfair Wager
Integer Part of Polynomial Equation’s Solutions
Sum of Sum of Divisors

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Mathematics in Cancer Treatment

How Mathematics is Transforming Cancer Treatment Mathematics plays an increasingly vital role in the fight against cancer mesothelioma. From optimizing drug delivery systems to personalizing

Read More »