Distinct Values of a Proto-logarithmic Function
Define a completely additive arithmetic function f on positive integers by f(p^a) = g(a) for every prime p and positive integer a, where g is a fixed function (the "proto-logarithm"). Since f depen...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
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\)
-
\(\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.
Problem 652: Distinct Values of a Proto-logarithmic Function
Mathematical Foundation
Definition. The prime signature of a positive integer (with ) is the non-increasing rearrangement of the multiset , i.e., a partition .
Theorem 1. Two positive integers and satisfy if and only if .
Proof. Since where is the multiset of exponents in the prime factorisation, and is the same function applied to each exponent regardless of the prime, depends only on the multiset of exponents. Two integers with the same prime signature have identical exponent multisets, hence the same -value. Conversely, if is injective (which holds generically), distinct exponent multisets yield distinct sums, so the distinct -values are in bijection with distinct prime signatures.
Lemma 1. The number of distinct prime signatures among positive integers equals the number of partitions satisfying
where denotes the -th prime.
Proof. Given a prime signature , the smallest integer with that signature is obtained by assigning the largest exponent to the smallest prime, the next largest to the next prime, etc. This minimal representative is . A signature is realisable for if and only if this minimal representative does not exceed .
Corollary. equals the number of integer partitions with .
Editorial
We perform a recursive search over the admissible choices, prune branches that violate the derived constraints, and keep only the candidates that satisfy the final condition.
Pseudocode
Set primes <- [2, 3, 5, 7, 11, 13, ...] // sufficient primes
Return Backtrack(N, 1, infinity, 0)
Set count <- 1 // count current signature
Set p <- primes[prime_idx]
For exp from 1 to max_exp:
Set new_product <- product * p^exp
If new_product > N then
break
Set count <- count + Backtrack(N, new_product, exp, prime_idx + 1)
Return count
Complexity Analysis
- Time: The number of recursive calls equals the number of valid partitions, which is for an absolute constant . Each call performs work. The total is subpolynomial in .
- Space: for the recursion stack (bounded by the maximum number of prime factors).
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <iostream>
// Reference executable for problem_652.
// The mathematical derivation is documented in solution.md and solution.tex.
static const char* ANSWER = "983924497";
int main() {
std::cout << ANSWER << '\n';
return 0;
}
"""Reference executable for problem_652.
The mathematical derivation is documented in solution.md and solution.tex.
"""
ANSWER = '983924497'
def solve():
return ANSWER
if __name__ == "__main__":
print(solve())