## A $10$-substring of a number is a substring of its digits that sum to $10$. For example, the $10$-substrings of the number $3523014$ are:

3523014

3523014

3523014

3523014

A number is called $10$-substring-friendly if every one of its digits belongs to a $10$-substring. For example, $3523014$ is $10$-substring-friendly, but $28546$ is not.

Let $T(n)$ be the number of $10$-substring-friendly numbers from $1$ to $10^n$ (inclusive).

For example $T(2) = 9$ and $T(5) = 3492$.

Find $T(10^{18}) \bmod 1\,000\,000\,007$.

### To find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over 100 different ways, we can use a brute-force approach to generate all pentagonal numbers and check if each number can be expressed as the sum of two pentagonal numbers.

The following Python code implements this approach:

“`python

def generate_pentagonal_numbers(n):

pentagonal_numbers = []

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

pentagonal_number = (i * (3*i – 1)) // 2

pentagonal_numbers.append(pentagonal_number)

return pentagonal_numbers

def find_smallest_pentagonal_number(num_ways):

pentagonal_numbers = generate_pentagonal_numbers(num_ways)

sums = set()

for i in range(len(pentagonal_numbers)):

for j in range(i+1, len(pentagonal_numbers)):

sum_of_pentagonals = pentagonal_numbers[i] + pentagonal_numbers[j]

if sum_of_pentagonals not in sums:

sums.add(sum_of_pentagonals)

else:

if len(sums) >= num_ways:

return sum_of_pentagonals

# Find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over 100 different ways

smallest_pentagonal_number = find_smallest_pentagonal_number(100)

print(smallest_pentagonal_number)

“`

This code first defines a function `generate_pentagonal_numbers(n)` that generates a list of `n` pentagonal numbers using the given formula. It iterates from 1 to `n` and calculates each pentagonal number using the provided formula.

Then, the function `find_smallest_pentagonal_number(num_ways)` is defined to find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over `num_ways` different ways. It generates the list of `num_ways` pentagonal numbers and stores the sums in a set. It iterates over the pentagonal numbers and checks if the sum of two pentagonal numbers is already present in the set. If it is, it returns the smallest pentagonal number that satisfies the condition.

Finally, the code calls the `find_smallest_pentagonal_number` function with `num_ways = 100` to find the smallest pentagonal number that can be expressed in over 100 different ways. The result is then printed to the console.

Note that finding the solution may take some time since we are using a brute-force approach.

##### More Answers:

Largest Prime Factors of Consecutive NumbersRandomized Binary Search

Constrained Sums