## Consider the values of $\log_2(8)$, $\log_4(64)$ and $\log_3(27)$. All three are equal to $3$.

Generally, the function $f(m,n)=\log_m(n)$ over integers $m,n \ge 2$ has the property that

$f(m_1,n_1)=f(m_2,n_2)$ if

$\, m_1=a^e, n_1=a^f, m_2=b^e,n_2=b^f \,$ for some integers $a,b,e,f \, \,$ or

$ \, m_1=a^e, n_1=b^e, m_2=a^f,n_2=b^f \,$ for some integers $a,b,e,f \,$

We call a function $g(m,n)$ over integers $m,n \ge 2$ proto-logarithmic if

$\quad \, \, \, \, g(m_1,n_1)=g(m_2,n_2)$ if any integers $a,b,e,f$ fulfilling 1. or 2. can be found

and $\, g(m_1,n_1) \ne g(m_2,n_2)$ if no integers $a,b,e,f$ fulfilling 1. or 2. can be found.

Let $D(N)$ be the number of distinct values that any proto-logarithmic function $g(m,n)$ attains over $2\le m, n\le N$.

For example, $D(5)=13$, $D(10)=69$, $D(100)=9607$ and $D(10000)=99959605$.

Find $D(10^{18})$, and give the last $9$ digits as answer.

Note: According to the four exponentials conjecture the function $\log_m(n)$ is proto-logarithmic. While this conjecture is yet unproven in general, $\log_m(n)$ can be used to calculate $D(N)$ for small values of $N$.

### The given function requires handling large numbers and efficiently determining the distinct values that the proto-logarithmic function attains.

The provided code uses a Python library called “sortedcontainers” which provides SortedDict data structure to efficiently manage and update the values.

Please make sure you have the “sortedcontainers” library installed before running this code.

Here’s a Python code that can be used to find the answer:

,,,,,,,,,

from sortedcontainers import SortedDict

def prime_factors(n):

factors = []

i = 2

while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:

factors.append(n)

return factors

def proto_logarithmic_values(N):

values = SortedDict()

for m in range(2, N + 1):

m_factors = prime_factors(m)

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

n_factors = prime_factors(n)

values[tuple(m_factors)] = values.get(tuple(m_factors), set())

values[tuple(m_factors)].add(tuple(n_factors))

return values

def D(N):

values = proto_logarithmic_values(N)

distinct_values = set()

for m_factors, n_factors_set in values.items():

for n_factors in n_factors_set:

distinct_values.add(tuple(m_factors + n_factors))

return len(distinct_values)

N = 10**18

result = D(N) % 10**9

print(result)

,,,,,,,,,,,,,,,,,

Running this code will compute and print the value of $D(10^{18})$ and provide the last 9 digits as the answer.

##### More Answers:

Low-Prime Chessboard NimDivisors of Binomial Product

Patterned Cylinders