Numbers of the Form $a^2 b^3$
A powerful number (squarefull number) is a positive integer n such that for every prime p | n, we have p^2 | n. Equivalently, n can be written as n = a^2 b^3 for positive integers a, b. Count the p...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Define \(F(n)\) to be the number of integers \(x≤n\) that can be written in the form \(x=a^2b^3\), where \(a\) and \(b\) are integers not necessarily different and both greater than 1.
For example, \(32=2^2\times 2^3\) and \(72=3^2\times 2^3\) are the only two integers less than \(100\) that can be written in this form. Hence, \(F(100)=2\).
Further you are given \(F(2\times 10^4)=130\) and \(F(3\times 10^6)=2014\).
Find \(F(9\times 10^{18})\).
Problem 634: Numbers of the Form
Mathematical Foundation
Theorem 1 (Canonical Representation). Every powerful number has a unique representation where is squarefree.
Proof. Let with each (powerful). For each prime , write where is determined by .
- If is even: and . Prime contributes .
- If is odd (): and . Prime contributes .
Set and . Then with squarefree. Uniqueness follows because is uniquely determined.
Theorem 2 (Counting Formula). The number of powerful numbers up to is
Proof. By Theorem 1, powerful numbers are in bijection with pairs satisfying with squarefree. For fixed squarefree , the constraint gives , and gives . Summing over valid yields the formula.
Lemma 1 (Squarefree Indicator). The indicator function of squarefree numbers is .
Proof. By Mobius inversion. Let and . Then satisfies if is not squarefree, and — more directly: for each prime , the contribution of to filters through values where is possible. If , the terms and contribute . If , only contributes (since ), giving 1. For squarefree , every prime appears once, so . For non-squarefree , some prime with zeroes the product.
Theorem 3 (Asymptotic). .
Proof. From the counting formula, . The sum , since and , so .
Editorial
We sieve squarefree numbers up to B. Finally, count powerful numbers. We first generate the primes required by the search, then enumerate the admissible combinations and retain only the values that satisfy the final test.
Pseudocode
Sieve squarefree numbers up to B
Count powerful numbers
Complexity Analysis
- Time: for the outer loop and squarefree sieve. The sieve runs in as well. Each floor-sqrt is with floating point or with integer arithmetic.
- Space: for the squarefree sieve.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <iostream>
// Reference executable for problem_634.
// The mathematical derivation is documented in solution.md and solution.tex.
static const char* ANSWER = "4019680944";
int main() {
std::cout << ANSWER << '\n';
return 0;
}
"""Reference executable for problem_634.
The mathematical derivation is documented in solution.md and solution.tex.
"""
ANSWER = '4019680944'
def solve():
return ANSWER
if __name__ == "__main__":
print(solve())