Does there exist a provable lower bound for how many numbers having a remainder $17\bmod{24}$ this algorithm will catch up to a certain binary length?

70 Views Asked by At

I have a "turing machine like" counting algorithm, which counts numbers having a remainder $17$ modulo $24$ that are generated by iterating some base $4$, base $3$ and base $2$ operations up to a given binary length as follows:

def count17mod24(s:int, max_bin_len:int)->int:    
    x=0
    q = queue.Queue()
    q.put(s)
    while not q.empty():
        n = q.get()
        if n%3 == 2:
            q.put((2*n-1)//3)
            if n % 24 == 17:
                x += 1
            if len(np.binary_repr(n)) < len(np.binary_repr(s))+max_bin_len-1:
                q.put(4*n+1)
        elif n%3 == 0:
            if len(np.binary_repr(n)) < len(np.binary_repr(s))+max_bin_len-1:
                q.put(4*n+1)
        elif n%3 == 1:
            if len(np.binary_repr(n)) < len(np.binary_repr(s))+max_bin_len and n>1:
                q.put((4*n-1)//3)
            if len(np.binary_repr(n)) < len(np.binary_repr(s))+max_bin_len-1:
                q.put(4*n+1)
    return x

When I am executing the algorithm using the starting number s=3 and the max_bin_len=10 by count17mod24(3, 10) then it yields 85. Keeping the starting number s=3 and executing this counting algorithm in the range from five to twenty range(5,21), we obtain the blue curve in the following graph:

enter image description here

My attempts:

I have tried to approximate the curve by experimentation. For example, the orange curve displays the function $f(x)=\frac{1}{24}2^{x-1}$ where as well $x=5,6,7,\ldots,20$ runs in the range from five to twenty. I used this orange curve simply by trial and error and it seems reasonably plausible as a lower limit - at least visually.

My question:

Is it possible to determine deductively any formula or theorem for a lower bound of these counts (given by the blue curve)? I would appreciate already some keywords to look up for approaching a solution of this counting problem.

In other words, my precise question is: If we start with number $3$ and iterate the operations of this turing machine up to a cetrain binary length, what is a provable lower bound of how many $[17]_{24}$ numbers the machine catches or equivalently, what is the upper bound of the $[17]_{24}$ it misses.

1

There are 1 best solutions below

0
On

I am part of the team and the point is that we do NOT count all $[17]_{24}$ numbers, we just count the ones that appear as generated by iterating certain base 4, base 2 and base 3 operations from the starting number that's the whole point.

So it is much trickier than just "counting all the $[17]_{24}$ numbers up to $2^n$" which is easy, the point is to count all the ones that are generated by the operations we define. All we need is a lower bound though.

So here is the detailed algorithm

For a given input starting number $s$ and max binary length $n$

initiate $[17]_{24}$ counter $X:=0$

If a number $x$ is in class $[2]_3$ :

generate $\frac{2x-1}{3}$

if length(x) $<$ length(s)+n-1

generate 4x+1

if $x$ is also in $[17]_{24}$ : X:=X+1

Delete $x$ 

If a number $x$ is in $[1]_3$ :

if length(x) $<$ length(s)+n

generate $\frac{4c-1}{3}$

if length(x) $<$ length(s)+n-1

generate 4x+1

Delete $x$ 

If a number $x$ is in $[0]_3$ :

if length(x) $<$ length(s)+n-1

generate 4x+1

Delete $x$