Fractal Sequence

Consider the infinite integer sequence S starting with:
$S = 1, 1, 2, 1, 3, 2, 4, 1, 5, 3, 6, 2, 7, 8, 4, 9, 1, 10, 11, 5, \dots$
Circle the first occurrence of each integer.
$S = \enclose{circle}1, 1, \enclose{circle}2, 1, \enclose{circle}3, 2, \enclose{circle}4, 1, \enclose{circle}5, 3, \enclose{circle}6, 2, \enclose{circle}7, \enclose{circle}8, 4, \enclose{circle}9, 1, \enclose{circle}{10}, \enclose{circle}{11}, 5, \dots$
The sequence is characterized by the following properties:
The circled numbers are consecutive integers starting with $1$.
Immediately preceding each non-circled numbers $a_i$, there are exactly $\lfloor \sqrt{a_i} \rfloor$ adjacent circled numbers, where $\lfloor\,\rfloor$ is the floor function.
If we remove all circled numbers, the remaining numbers form a sequence identical to $S$, so $S$ is a fractal sequence.
Let $T(n)$ be the sum of the first $n$ elements of the sequence.
You are given $T(1) = 1$, $T(20) = 86$, $T(10^3) = 364089$ and $T(10^9) = 498676527978348241$.
Find $T(10^{18})$. Give the last $9$ digits of your answer.

This problem involves high-precision computation and pattern-finding, and requires skills outside the standard range of a human mathematics tutor. Thus, providing an exact short solution via a text-based response may not be immediately feasible. However, for an exploration on how such a problem could be approached, read on.

First, any function named “T” (or generally, any function in number theory), hints towards the use of number theory or combinatorics to solve the problem. Now, noticing that the question asks only for the “last 9 digits” of a number, it is highly likely that we are being directed to a modular arithmetic-based approach.

The structure of the sequence “S” is complex and may not lend itself to a simple direct analysis. A more tractable approach may be to devise a way of generating the sequence (or at least its sum up to “n” terms) iteratively, while maintaining only the last 9 digits.

What’s unique about this sequence are two things:
1. At the beginning of each new integer, we start by putting it into the sequence, then preceding it by a bunch of numbers that came before it.
2. When we remove all circled numbers, we have the same sequence.

Understanding these can lead us to an iterative approach to solve the problem. The challenge is understanding how to translate “a sequence within a sequence” into an iterative process.

We can try and approach it this way. If the number is “k”, then we don’t start from 1, but we start from “k” and keep adding the numbers till “1” followed by the next “k” minus 1 numbers in the sequence.

So let’s start with the number 1. We only have 1 in the sequence. Next number is 2. So instead of putting 1, we have 2, 1 in the sequence. The third number is 3. So we don’t put 1 and 2, but 3, 2, 1 gives us the next set of numbers in the sequence. We proceed in this fashion till we cover the given range of “n”.

To put it all together, we can define a recursive function T(n) thus:

T(n) = T(n-1) + n + sum of the previous (n-1) terms of T (modulus 10^9)

This method however is an exponential style of computation and may not feasible to directly apply to obtain T(10^18). We may need smart computational logic/program to solve for such high values, such as implementing memoization to store and reuse previous results instead of repeated calculations. This problem is much more of a competitive programming contest problem than a standard math tutors’ task. Therefore, a direct solution or running code is not readily available, but hopefully this sets up a starting point on how to think about the problem.

More Answers:
Nanobots on Geodesics
Minimum Values of the Carmichael Function
Weak Queens

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 »